Skip to content

Commit 519f403

Browse files
committed
refresh batch tablet locations when drop table using lsbatch, use runtimeBatchMaxWait to retry lsbatch
1 parent fc3b3e9 commit 519f403

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/main/java/com/alipay/oceanbase/rpc/exception/ObTableNeedFetchMetaException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public boolean isNeedRefreshMetaAndLocation() {
7373
|| getErrorCode() == ResultCodes.OB_SNAPSHOT_DISCARDED.errorCode // fetch a wrong ls tablets, need to refetch locations
7474
|| getErrorCode() == ResultCodes.OB_TABLET_NOT_EXIST.errorCode
7575
|| getErrorCode() == ResultCodes.OB_ERR_OPERATION_ON_RECYCLE_OBJECT.errorCode // table has been drop and recreated
76-
|| getErrorCode() == ResultCodes.OB_MAPPING_BETWEEN_TABLET_AND_LS_NOT_EXIST.errorCode;
76+
|| getErrorCode() == ResultCodes.OB_MAPPING_BETWEEN_TABLET_AND_LS_NOT_EXIST.errorCode
77+
|| getErrorCode() == ResultCodes.OB_SCHEMA_ERROR.errorCode; // drop table
7778
}
7879
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,6 @@ private static void getTabletLsId(final Connection connection, TableEntry tableE
931931
if (rs.wasNull()) {
932932
continue;
933933
}
934-
logger.warn("[latency monitor] refresh batch location, lsId: {}, tabletId: {}", lsId, tabletId);
935934
tabletLsMap.put(tabletId, lsId);
936935
ObPartitionLocationInfo partitionLocationInfo = partitionEntry
937936
.getPartitionInfo(tabletId);

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ public void partitionExecute(ObTableSingleOpResult[] results,
745745
}
746746

747747
long endExecute = System.currentTimeMillis();
748+
logger.warn("[latency monitor] finish partitionExecute using: {}", endExecute - startExecute);
748749

749750
if (subLSOpResult == null) {
750751
String logMessage = String.format(
@@ -832,13 +833,13 @@ private void executeWithRetries(ObTableSingleOpResult[] results,
832833
currentPartitions.put(entry.getKey(), entry.getValue());
833834
int errCode = ResultCodes.OB_SUCCESS.errorCode;
834835
String errMsg = null;
835-
long runTimeMaxWait = obTableClient.getRuntimeMaxWait();
836+
long runTimeMaxWait = obTableClient.getRuntimeBatchMaxWait();
836837
long startExecute = System.currentTimeMillis();
837838
while (true) {
838839
long costMillis = System.currentTimeMillis() - startExecute;
839840
if (costMillis > runTimeMaxWait) {
840841
errMsg = tableName + " failed to execute operation after retrying " + retryCount
841-
+ " times and it has waited" + costMillis + " ms"
842+
+ " times and it has waited " + costMillis + " ms"
842843
+ " which exceeds runtime max wait timeout " + runTimeMaxWait
843844
+ " ms. Last error Msg:" + "[errCode=" + errCode + "] " + errMsg;
844845
logger.error(errMsg);
@@ -851,6 +852,7 @@ private void executeWithRetries(ObTableSingleOpResult[] results,
851852
partitionExecute(results, currentEntry);
852853
} catch (Exception e) {
853854
if (shouldRetry(e)) {
855+
long start = System.currentTimeMillis();
854856
logger.warn("ls batch meet should retry exception", e);
855857
retryCount++;
856858
errCode = ((ObTableNeedFetchMetaException) e).getErrorCode();
@@ -859,6 +861,7 @@ private void executeWithRetries(ObTableSingleOpResult[] results,
859861
.getValue());
860862
currentPartitions = prepareOperations(failedOperations);
861863
allPartitionsSuccess = false;
864+
logger.warn("[latency monitor] finish ls batch retry prepare using: {}", System.currentTimeMillis() - start);
862865
break;
863866
} else {
864867
throw e;

0 commit comments

Comments
 (0)