Skip to content

Commit be517a3

Browse files
committed
odp support new hbase protocol
1 parent 49bc74c commit be517a3

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

src/main/java/com/alipay/oceanbase/rpc/ObGlobal.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ public static boolean isHBasePutPerfSupport() {
125125
return OB_VERSION >= OB_VERSION_4_4_1_0;
126126
}
127127

128+
/*-------------------------------------------- OB_VERSION --------------------------------------------*/
129+
128130
public static final long OB_VERSION_4_2_3_0 = calcVersion(4, (short) 2, (byte) 3, (byte) 0);
129131

130132
public static final long OB_VERSION_4_2_5_2 = calcVersion(4, (short) 2, (byte) 5, (byte) 2);
@@ -146,4 +148,12 @@ public static boolean isHBasePutPerfSupport() {
146148
public static final long OB_VERSION_4_4_1_0 = calcVersion(4, (short) 4, (byte) 1, (byte) 0);
147149

148150
public static long OB_VERSION = calcVersion(0, (short) 0, (byte) 0, (byte) 0);
151+
152+
/*-------------------------------------------- OB_PROXY_VERSION --------------------------------------------*/
153+
154+
public static final long OB_PROXY_VERSION_4_3_5_0 = calcVersion(4, (short) 3, (byte) 5, (byte) 0);
155+
156+
public static final long OB_PROXY_VERSION_4_3_6_0 = calcVersion(4, (short) 3, (byte) 6, (byte) 0);
157+
158+
public static long OB_PROXY_VERSION = calcVersion(0, (short) 0, (byte) 0, (byte) 0);
149159
}

src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,18 +2507,24 @@ public static void parseObVerionFromLogin(String serverVersion)
25072507
throws FeatureNotSupportedException {
25082508
Pattern pattern;
25092509
if (serverVersion.startsWith("OceanBase_CE")) {
2510-
// serverVersion in CE is like "OceanBase_CE 4.0.0.0"
2511-
pattern = Pattern.compile("OceanBase_CE\\s+(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)");
2510+
// serverVersion in CE is like "OceanBase_CE 4.0.0.0 (+ Obproxy 4.3.6.0), content in () is optional and valid after Obproxy 4.3.5"
2511+
pattern = Pattern.compile("OceanBase_CE\\s+(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(\\s+\\+\\s+(Obproxy)\\s+(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+))?");
25122512
} else {
2513-
// serverVersion is like "OceanBase 4.0.0.0"
2514-
pattern = Pattern.compile("OceanBase\\s+(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)");
2513+
// serverVersion is like "OceanBase 4.0.0.0 (+ Obproxy 4.3.6.0), content in () is optional and valid after Obproxy 4.3.5"
2514+
pattern = Pattern.compile("OceanBase\\s+(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)(\\s+\\+\\s+(Obproxy)\\s+(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+))?");
25152515
}
25162516
Matcher matcher = pattern.matcher(serverVersion);
25172517
if (matcher.find() && ObGlobal.OB_VERSION == 0) {
25182518
ObGlobal.OB_VERSION = ObGlobal.calcVersion(Integer.parseInt(matcher.group(1)),
25192519
(short) Integer.parseInt(matcher.group(2)),
25202520
(byte) Integer.parseInt(matcher.group(3)),
25212521
(byte) Integer.parseInt(matcher.group(4)));
2522+
if (matcher.group(5) != null && matcher.group(6) != null) { // Obproxy part
2523+
ObGlobal.OB_PROXY_VERSION = ObGlobal.calcVersion(Integer.parseInt(matcher.group(7)),
2524+
(short) Integer.parseInt(matcher.group(8)),
2525+
(byte) Integer.parseInt(matcher.group(9)),
2526+
(byte) Integer.parseInt(matcher.group(10)));
2527+
}
25222528
if (ObGlobal.obVsnMajor() < 4) {
25232529
throw new FeatureNotSupportedException(
25242530
"The current client version supports only server version greater than or equal to 4.0.0.0");

0 commit comments

Comments
 (0)