Skip to content

Commit 708589c

Browse files
committed
fix schema version not updated in retry
1 parent 8785d47 commit 708589c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@ private static TableEntry getTableEntryFromResultSet(TableEntryKey key, ResultSe
14521452
}
14531453
TableLocation tableLocation = new TableLocation();
14541454
tableLocation.setReplicaLocations(replicaLocations);
1455+
logger.info("refresh meta get new schema_version: {}", schemaVersion);
14551456
if (!replicaLocations.isEmpty()) {
14561457
entry.setTableId(tableId);
14571458
entry.setTableLocation(tableLocation);

src/main/java/com/alipay/oceanbase/rpc/location/model/TableLocations.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,10 @@ public TableEntry refreshPartitionLocation(TableEntry tableEntry, String tableNa
329329
throw e;
330330
} catch (ObTableSchemaVersionMismatchException e) {
331331
RUNTIME.error(
332-
"refresh partition location meet schema_version mismatched exception", e);
332+
"refresh partition location meet schema_version mismatched exception, tryTimes: {}", i, e);
333+
if (i >= retryTimes - 1) {
334+
throw e;
335+
}
333336
long schemaVersion = tableEntry.getSchemaVersion();
334337
// sleep over waiting interval of refreshing meta to refresh meta
335338
long interval = System.currentTimeMillis()
@@ -340,7 +343,7 @@ public TableEntry refreshPartitionLocation(TableEntry tableEntry, String tableNa
340343
tableEntry = locations.get(tableName);
341344
// if schema_version has been updated, directly retry
342345
if (schemaVersion == tableEntry.getSchemaVersion()) {
343-
refreshMeta(tableName, serverRoster, sysUA);
346+
tableEntry = refreshMeta(tableName, serverRoster, sysUA);
344347
}
345348
} catch (ObTableEntryRefreshException e) {
346349
RUNTIME.error("refresh partition location meet entry refresh exception", e);
@@ -453,7 +456,10 @@ public TableEntry refreshTabletLocationBatch(TableEntry tableEntry, String table
453456
throw e;
454457
} catch (ObTableSchemaVersionMismatchException e) {
455458
RUNTIME.error(
456-
"refresh location in batch meet schema_version mismatched exception", e);
459+
"refresh location in batch meet schema_version mismatched exception, tryTimes: {}", i, e);
460+
if (i >= retryTimes - 1) {
461+
throw e;
462+
}
457463
long schemaVersion = tableEntry.getSchemaVersion();
458464
// sleep over waiting interval of refreshing meta to refresh meta
459465
long interval = System.currentTimeMillis()
@@ -464,7 +470,7 @@ public TableEntry refreshTabletLocationBatch(TableEntry tableEntry, String table
464470
tableEntry = locations.get(tableName);
465471
// if schema_version has been updated, directly retry
466472
if (schemaVersion == tableEntry.getSchemaVersion()) {
467-
refreshMeta(tableName, serverRoster, sysUA);
473+
tableEntry = refreshMeta(tableName, serverRoster, sysUA);
468474
}
469475
} catch (ObTableEntryRefreshException e) {
470476
RUNTIME.error("refresh location in batch meet entry refresh exception", e);

0 commit comments

Comments
 (0)