Skip to content

Commit c732673

Browse files
authored
branch-3.1: [opt](compatibility) let version mutable apache#55335 (apache#56630)
picked from apache#55335
1 parent 2ab394e commit c732673

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

fe/fe-core/src/main/java/org/apache/doris/mysql/MysqlHandshakePacket.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.apache.doris.mysql;
1919

20+
import org.apache.doris.qe.GlobalVariable;
21+
2022
// MySQL protocol handshake packet.
2123
public class MysqlHandshakePacket extends MysqlPacket {
2224
private static final int SCRAMBLE_LENGTH = 20;
@@ -25,7 +27,7 @@ public class MysqlHandshakePacket extends MysqlPacket {
2527
// JDBC uses this version to check which protocol the server support
2628
// Set the patch version to 99 to prevent the vulnerability scanning tool from
2729
// falsely reporting MySQL vulnerabilities
28-
public static final String SERVER_VERSION = "5.7.99";
30+
public static final String DEFAULT_SERVER_VERSION = "5.7.99";
2931
// 33 stands for UTF-8 character set
3032
private static final int CHARACTER_SET = 33;
3133
// use default capability for all
@@ -53,7 +55,7 @@ public void writeTo(MysqlSerializer serializer) {
5355
MysqlCapability capability = MysqlProto.SERVER_USE_SSL ? SSL_CAPABILITY : CAPABILITY;
5456

5557
serializer.writeInt1(PROTOCOL_VERSION);
56-
serializer.writeNulTerminateString(SERVER_VERSION);
58+
serializer.writeNulTerminateString(GlobalVariable.version);
5759
serializer.writeInt4(connectionId);
5860
// first 8 bytes of auth plugin data
5961
serializer.writeBytes(authPluginData, 0, 8);

fe/fe-core/src/main/java/org/apache/doris/qe/GlobalVariable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public final class GlobalVariable {
8787
+ Version.DORIS_BUILD_VERSION + "-" + Version.DORIS_BUILD_SHORT_HASH
8888
+ (Config.isCloudMode() ? " (Cloud Mode)" : "");
8989

90-
@VariableMgr.VarAttr(name = VERSION, flag = VariableMgr.READ_ONLY)
91-
public static String version = MysqlHandshakePacket.SERVER_VERSION;
90+
@VariableMgr.VarAttr(name = VERSION)
91+
public static String version = MysqlHandshakePacket.DEFAULT_SERVER_VERSION;
9292

9393
// 0: table names are stored as specified and comparisons are case sensitive.
9494
// 1: table names are stored in lowercase on disk and comparisons are not case sensitive.

0 commit comments

Comments
 (0)