Skip to content

Commit 7206031

Browse files
committed
fix odp mode fail to force refresh partition meta
1 parent 0e7f901 commit 7206031

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

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

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ public TableEntry refreshMeta(String tableName, ServerRoster serverRoster,
134134
try {
135135
if (!acquired) {
136136
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
137-
}
138-
if (!acquired) {
139-
String errMsg = "try to lock tableEntry refreshing timeout, tableName:" + tableName
140-
+ " , timeout:" + tableEntryRefreshLockTimeout + ".";
141-
RUNTIME.warn(errMsg);
142-
throw new ObTableTryLockTimeoutException(errMsg);
137+
if (!acquired) {
138+
String errMsg = "try to lock tableEntry refreshing timeout, tableName:" + tableName
139+
+ " , timeout:" + tableEntryRefreshLockTimeout + ".";
140+
RUNTIME.warn(errMsg);
141+
throw new ObTableTryLockTimeoutException(errMsg);
142+
}
143143
}
144144
logger.debug("success to acquire refresh table meta lock, tableName: {}", tableName);
145145
tableEntry = locations.get(tableName);
@@ -316,12 +316,12 @@ public TableEntry refreshPartitionLocation(TableEntry tableEntry, String tableNa
316316
try {
317317
if (!acquired) {
318318
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
319-
}
320-
if (!acquired) {
321-
String errMsg = "try to lock tablet location refreshing timeout " + " ,tableName:"
322-
+ tableName + " , timeout:" + tableEntryRefreshLockTimeout + ".";
323-
RUNTIME.warn(errMsg);
324-
throw new ObTableTryLockTimeoutException(errMsg);
319+
if (!acquired) {
320+
String errMsg = "try to lock tablet location refreshing timeout " + " ,tableName:"
321+
+ tableName + " , timeout:" + tableEntryRefreshLockTimeout + ".";
322+
RUNTIME.warn(errMsg);
323+
throw new ObTableTryLockTimeoutException(errMsg);
324+
}
325325
}
326326
logger.debug("success acquire refresh table location lock, tableName: {}", tableName);
327327
locationInfo = tableEntry.getPartitionEntry().getPartitionInfo(tabletId);
@@ -443,12 +443,12 @@ public TableEntry refreshTabletLocationBatch(TableEntry tableEntry, String table
443443
try {
444444
if (!acquired) {
445445
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
446-
}
447-
if (!acquired) {
448-
String errMsg = "try to lock locations refreshing in batch timeout " + " ,tableName:"
449-
+ tableName + " , timeout:" + tableEntryRefreshLockTimeout + ".";
450-
RUNTIME.warn(errMsg);
451-
throw new ObTableTryLockTimeoutException(errMsg);
446+
if (!acquired) {
447+
String errMsg = "try to lock locations refreshing in batch timeout " + " ,tableName:"
448+
+ tableName + " , timeout:" + tableEntryRefreshLockTimeout + ".";
449+
RUNTIME.warn(errMsg);
450+
throw new ObTableTryLockTimeoutException(errMsg);
451+
}
452452
}
453453
logger.debug("success to acquire refresh tablet locations in batch lock, tableName: {}", tableName);
454454
lastRefreshTime = tableEntry.getPartitionEntry().getLastRefreshAllTime();
@@ -579,14 +579,16 @@ public TableEntry refreshODPMeta(String tableName, boolean forceRefresh, ObTable
579579
try {
580580
// attempt lock the refreshing action, avoiding concurrent refreshing
581581
// use the time-out mechanism, avoiding the rpc hanging up
582-
acquired = lock.tryLock(tableClient.getODPTableEntryRefreshLockTimeout(),
583-
TimeUnit.MILLISECONDS);
584582
if (!acquired) {
585-
String errMsg = "try to lock odpTable-entry refreshing timeout " + " ,tableName:"
586-
+ tableName + " , timeout:"
587-
+ tableClient.getODPTableEntryRefreshLockTimeout() + ".";
588-
RUNTIME.warn(errMsg);
589-
throw new ObTableTryLockTimeoutException(errMsg);
583+
acquired = lock.tryLock(tableClient.getODPTableEntryRefreshLockTimeout(),
584+
TimeUnit.MILLISECONDS);
585+
if (!acquired) {
586+
String errMsg = "try to lock odpTable-entry refreshing timeout " + " ,tableName:"
587+
+ tableName + " , timeout:"
588+
+ tableClient.getODPTableEntryRefreshLockTimeout() + ".";
589+
RUNTIME.warn(errMsg);
590+
throw new ObTableTryLockTimeoutException(errMsg);
591+
}
590592
}
591593
if (locations.get(tableName) != null) {
592594
odpTableEntry = locations.get(tableName);
@@ -633,6 +635,7 @@ public TableEntry refreshODPMeta(String tableName, boolean forceRefresh, ObTable
633635
}
634636
}
635637
locations.put(tableName, odpTableEntry);
638+
return odpTableEntry;
636639
} catch (ObTableTryLockTimeoutException e) {
637640
// if try lock timeout, need to retry
638641
RUNTIME.warn("wait to try lock to timeout when refresh table meta, tryTimes: {}",

0 commit comments

Comments
 (0)