Skip to content

Commit 4d71617

Browse files
committed
get server capacity in odp mode
1 parent d5f301e commit 4d71617

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,12 +4247,19 @@ public ObServerRoute getRoute(boolean readonly) {
42474247
}
42484248

42494249
public ObTableServerCapacity getServerCapacity() {
4250-
if (tableRoster.isEmpty()) {
4251-
throw new IllegalStateException("client is not initialized and obTable is empty");
4250+
if (isOdpMode()) {
4251+
if (odpTable == null) {
4252+
throw new IllegalStateException("client is not initialized and obTable is empty");
4253+
}
4254+
return odpTable.getServerCapacity();
4255+
} else {
4256+
if (tableRoster == null || tableRoster.isEmpty()) {
4257+
throw new IllegalStateException("client is not initialized and obTable is empty");
4258+
}
4259+
Iterator<ObTable> iterator = tableRoster.values().iterator();
4260+
ObTable firstObTable = iterator.next();
4261+
return firstObTable.getServerCapacity();
42524262
}
4253-
Iterator<ObTable> iterator = tableRoster.values().iterator();
4254-
ObTable firstObTable = iterator.next();
4255-
return firstObTable.getServerCapacity();
42564263
}
42574264

42584265
public void setOdpAddr(String odpAddr) {

0 commit comments

Comments
 (0)