Skip to content

Commit 8d81dc7

Browse files
committed
fix lsop retry fail
1 parent ec0e079 commit 8d81dc7

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ public TableEntry refreshTableLocationByTabletId(TableEntry tableEntry, String t
13651365
RUNTIME.error("RefreshTableEntry encountered an exception", e);
13661366
throw e;
13671367
} catch (Exception e) {
1368-
String errorMsg = String.format("Failed to get table entry. Key=%s, Original TableEntry=%s", tableEntryKey, tableEntry);
1368+
String errorMsg = String.format("Failed to get table entry. Key=%s, Original TableEntry=%s, TabletId=%d", tableEntryKey, tableEntry, tabletId);
13691369
RUNTIME.error(LCD.convert("01-00020"), tableEntryKey, tableEntry, e);
13701370
throw new ObTableEntryRefreshException(errorMsg, e);
13711371
}
@@ -1949,7 +1949,7 @@ private List<Long> getPartitionTablePartitionIds(TableEntry tableEntry,
19491949
}
19501950
}
19511951

1952-
private long getTabletIdByPartId(TableEntry tableEntry, Long partId) {
1952+
public long getTabletIdByPartId(TableEntry tableEntry, Long partId) {
19531953
if (ObGlobal.obVsnMajor() >= 4 && tableEntry.isPartitionTable()) {
19541954
ObPartitionInfo partInfo = tableEntry.getPartitionInfo();
19551955
Map<Long, Long> tabletIdMap = partInfo.getPartTabletIdMap();
@@ -2041,17 +2041,17 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20412041
ObServerAddr addr = replica.getAddr();
20422042
ObTable obTable = tableRoster.get(addr);
20432043
boolean addrExpired = addr.isExpired(serverAddressCachingTimeout);
2044-
// if (addrExpired || obTable == null) {
2045-
// logger
2046-
// .warn(
2047-
// "server address {} is expired={} or can not get ob table. So that will sync refresh metadata",
2048-
// addr, addrExpired);
2049-
// syncRefreshMetadata();
2050-
// tableEntry = getOrRefreshTableEntry(tableName, true, waitForRefresh, false);
2051-
// replica = getPartitionLocation(tableEntry, partId, route);
2052-
// addr = replica.getAddr();
2053-
// obTable = tableRoster.get(addr);
2054-
// }
2044+
if (addrExpired || obTable == null) {
2045+
logger
2046+
.warn(
2047+
"server address {} is expired={} or can not get ob table. So that will sync refresh metadata",
2048+
addr, addrExpired);
2049+
syncRefreshMetadata();
2050+
tableEntry = getOrRefreshTableEntry(tableName, true, waitForRefresh, false);
2051+
replica = getPartitionLocation(tableEntry, tabletId, route);
2052+
addr = replica.getAddr();
2053+
obTable = tableRoster.get(addr);
2054+
}
20552055

20562056
if (obTable == null) {
20572057
RUNTIME.error("cannot get table by addr: " + addr);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,6 @@ public static TableEntry getTableEntryLocationFromRemote(Connection connection,
874874
// ignore
875875
}
876876
}
877-
// 可能不需要了
878877
tableEntry.setRefreshTimeMills(System.currentTimeMillis());
879878
return tableEntry;
880879
}

0 commit comments

Comments
 (0)