Skip to content

Commit 1d46a86

Browse files
committed
fix lsop retry fail
1 parent 6874323 commit 1d46a86

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
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
@@ -1364,7 +1364,7 @@ public TableEntry refreshTableLocationByTabletId(TableEntry tableEntry, String t
13641364
RUNTIME.error("RefreshTableEntry encountered an exception", e);
13651365
throw e;
13661366
} catch (Exception e) {
1367-
String errorMsg = String.format("Failed to get table entry. Key=%s, Original TableEntry=%s", tableEntryKey, tableEntry);
1367+
String errorMsg = String.format("Failed to get table entry. Key=%s, Original TableEntry=%s, TabletId=%d", tableEntryKey, tableEntry, tabletId);
13681368
RUNTIME.error(LCD.convert("01-00020"), tableEntryKey, tableEntry, e);
13691369
throw new ObTableEntryRefreshException(errorMsg, e);
13701370
}
@@ -1939,7 +1939,7 @@ private List<Long> getPartitionTablePartitionIds(TableEntry tableEntry,
19391939
}
19401940
}
19411941

1942-
private long getTabletIdByPartId(TableEntry tableEntry, Long partId) {
1942+
public long getTabletIdByPartId(TableEntry tableEntry, Long partId) {
19431943
if (ObGlobal.obVsnMajor() >= 4 && tableEntry.isPartitionTable()) {
19441944
ObPartitionInfo partInfo = tableEntry.getPartitionInfo();
19451945
Map<Long, Long> tabletIdMap = partInfo.getPartTabletIdMap();
@@ -2032,17 +2032,17 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20322032
ObServerAddr addr = replica.getAddr();
20332033
ObTable obTable = tableRoster.get(addr);
20342034
boolean addrExpired = addr.isExpired(serverAddressCachingTimeout);
2035-
// if (addrExpired || obTable == null) {
2036-
// logger
2037-
// .warn(
2038-
// "server address {} is expired={} or can not get ob table. So that will sync refresh metadata",
2039-
// addr, addrExpired);
2040-
// syncRefreshMetadata();
2041-
// tableEntry = getOrRefreshTableEntry(tableName, true, waitForRefresh, false);
2042-
// replica = getPartitionLocation(tableEntry, partId, route);
2043-
// addr = replica.getAddr();
2044-
// obTable = tableRoster.get(addr);
2045-
// }
2035+
if (addrExpired || obTable == null) {
2036+
logger
2037+
.warn(
2038+
"server address {} is expired={} or can not get ob table. So that will sync refresh metadata",
2039+
addr, addrExpired);
2040+
syncRefreshMetadata();
2041+
tableEntry = getOrRefreshTableEntry(tableName, true, waitForRefresh, false);
2042+
replica = getPartitionLocation(tableEntry, tabletId, route);
2043+
addr = replica.getAddr();
2044+
obTable = tableRoster.get(addr);
2045+
}
20462046

20472047
if (obTable == null) {
20482048
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
}

src/main/java/com/alipay/oceanbase/rpc/table/ObTableClientLSBatchOpsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ public void doTask() {
740740
// Execute sub-batch operation one by one
741741
for (final Map.Entry<Long, Map<Long, ObPair<ObTableParam, List<ObPair<Integer, ObTableSingleOp>>>>> entry : lsOperations
742742
.entrySet()) {
743-
partitionExecute(obTableOperationResults, entry);
743+
executeWithRetries(obTableOperationResults, entry, maxRetries);
744744
}
745745
}
746746

0 commit comments

Comments
 (0)