Skip to content

Commit f6037ad

Browse files
committed
set refresh interval to 100ms from 300ms to ensure refreshing correct ls_id when ls batch retry
1 parent cbd1948 commit f6037ad

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public TableEntry refreshMeta(String tableName, ServerRoster serverRoster,
9696
int tableEntryRefreshContinuousFailureCeiling = tableClient
9797
.getTableEntryRefreshContinuousFailureCeiling();
9898
long tableEntryRefreshLockTimeout = tableClient.getTableEntryRefreshLockTimeout();
99-
long refreshMetaInterval = 300L;
99+
long refreshMetaInterval = 100L;
100100

101101
TableEntry tableEntry = locations.get(tableName);
102102
// avoid bad contention in high concurrent situation
@@ -275,7 +275,7 @@ public TableEntry refreshPartitionLocation(TableEntry tableEntry, String tableNa
275275
int tableEntryRefreshTryTimes = tableClient.getTableEntryRefreshTryTimes();
276276
long tableEntryRefreshLockTimeout = tableClient.getTableEntryRefreshLockTimeout();
277277
long lastRefreshTime = locationInfo.getLastUpdateTime();
278-
long tableEntryRefreshInterval = 300L;
278+
long tableEntryRefreshInterval = 100L;
279279
long currentTime = System.currentTimeMillis();
280280
// do not refresh tablet location if refreshed within 300 milliseconds
281281
if (currentTime - lastRefreshTime < tableEntryRefreshInterval) {
@@ -332,8 +332,8 @@ public TableEntry refreshPartitionLocation(TableEntry tableEntry, String tableNa
332332
long interval = System.currentTimeMillis()
333333
- tableEntry.getRefreshMetaTimeMills();
334334
logger.warn("[latency monitor] interval is: {}", interval);
335-
if (interval < 300) {
336-
Thread.sleep(300 - interval);
335+
if (interval < 100) {
336+
Thread.sleep(100 - interval);
337337
}
338338
tableEntry = locations.get(tableName);
339339
// if schema_version has been updated, directly retry
@@ -397,7 +397,7 @@ public TableEntry refreshTabletLocationBatch(TableEntry tableEntry, String table
397397
int tableEntryRefreshTryTimes = tableClient.getTableEntryRefreshTryTimes();
398398
long tableEntryRefreshLockTimeout = tableClient.getTableEntryRefreshLockTimeout();
399399
long lastRefreshTime = tableEntry.getPartitionEntry().getLastRefreshAllTime();
400-
long tableEntryRefreshInterval = 300L;
400+
long tableEntryRefreshInterval = 100L;
401401
long currentTime = System.currentTimeMillis();
402402
// do not refresh tablet location if refreshed within 300 milliseconds
403403
if (currentTime - lastRefreshTime < tableEntryRefreshInterval) {
@@ -456,8 +456,8 @@ public TableEntry refreshTabletLocationBatch(TableEntry tableEntry, String table
456456
long interval = System.currentTimeMillis()
457457
- tableEntry.getRefreshMetaTimeMills();
458458
logger.warn("[latency monitor] interval is: {}", interval);
459-
if (interval < 300) {
460-
Thread.sleep(300 - interval);
459+
if (interval < 100) {
460+
Thread.sleep(100 - interval);
461461
}
462462
tableEntry = locations.get(tableName);
463463
// if schema_version has been updated, directly retry

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,9 @@ private void executeWithRetries(ObTableSingleOpResult[] results,
833833
int errCode = ResultCodes.OB_SUCCESS.errorCode;
834834
String errMsg = null;
835835
int maxRetryTimes = obTableClient.getRuntimeRetryTimes();
836+
// cannot use runTimeWait to retry to timeout
837+
// because in huge-partitioned table situation, if refresh all tablets' locations
838+
// it's hard to complete refreshing within time limit
836839
while (retryCount < maxRetryTimes && !success) {
837840
boolean allPartitionsSuccess = true;
838841

0 commit comments

Comments
 (0)