Skip to content

Commit 9239927

Browse files
committed
enable server version checking in odp mode
1 parent 2c8e02b commit 9239927

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableConnection.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ private void login() throws Exception {
195195
// no need to retry when the username or password is wrong.
196196
if (e instanceof ObTableAuthException) {
197197
throw new ObTableLoginException(errMessage, e);
198+
} else if (e instanceof FeatureNotSupportedException) {
199+
throw e;
198200
}
199201
}
200202
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2525,7 +2525,8 @@ private static void parseObVersionFromSQL(String serverVersion)
25252525
}
25262526
}
25272527

2528-
public static void parseObVerionFromLogin(String serverVersion) {
2528+
public static void parseObVerionFromLogin(String serverVersion)
2529+
throws FeatureNotSupportedException {
25292530
Pattern pattern;
25302531
if (serverVersion.startsWith("OceanBase_CE")) {
25312532
// serverVersion in CE is like "OceanBase_CE 4.0.0.0"
@@ -2540,6 +2541,10 @@ public static void parseObVerionFromLogin(String serverVersion) {
25402541
(short) Integer.parseInt(matcher.group(2)),
25412542
(byte) Integer.parseInt(matcher.group(3)),
25422543
(byte) Integer.parseInt(matcher.group(4)));
2544+
if (ObGlobal.obVsnMajor() < 4) {
2545+
throw new FeatureNotSupportedException(
2546+
"The current client version supports only server version greater than or equal to 4.0.0.0");
2547+
}
25432548
}
25442549
}
25452550
}

0 commit comments

Comments
 (0)