Skip to content

Commit 293353b

Browse files
committed
refresh tablet address after refresh obTable roster
1 parent 1ac9720 commit 293353b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2050,8 +2050,22 @@ public ObPair<Long, ObTableParam> getTableInternal(String tableName, TableEntry
20502050
obTable = tableRoster.get(addr);
20512051

20522052
if (obTable == null) {
2053-
RUNTIME.error("Cannot get table by addr: " + addr);
2054-
throw new ObTableGetException("Cannot get table by addr: " + addr);
2053+
// the addr is wrong, need to refresh location
2054+
if (RUNTIME.isInfoEnabled()) {
2055+
RUNTIME.info("Cannot get table by addr: " + addr);
2056+
}
2057+
tableEntry = refreshTableLocationByTabletId(tableEntry, tableName, tabletId);
2058+
obPartitionLocationInfo = tableEntry.getPartitionEntry().getPartitionInfo(tabletId);
2059+
replica = getPartitionLocation(obPartitionLocationInfo, route);
2060+
if (replica == null) {
2061+
RUNTIME.error("Cannot get replica by partId: " + partId);
2062+
throw new ObTableGetException("Cannot get replica by partId: " + partId);
2063+
}
2064+
addr = replica.getAddr();
2065+
obTable = tableRoster.get(addr);
2066+
if (obTable == null) {
2067+
throw new ObTableGetException("obTable is null, addr is: " + addr.getIp() + ":" + addr.getSvrPort());
2068+
}
20552069
}
20562070
}
20572071
ObTableParam param = createTableParam(obTable, tableEntry, obPartitionLocationInfo, partId, tabletId);

0 commit comments

Comments
 (0)