Skip to content

Commit ce144d8

Browse files
committed
add retry logic for executeMutation
1 parent d1c663f commit ce144d8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ private <T> T executeMutation(String tableName, MutationExecuteCallback<T> callb
767767
throw new IllegalArgumentException("table name is null");
768768
}
769769
boolean needRefreshTableEntry = false;
770-
boolean needFetchAllRouteInfo = false;
771770
int tryTimes = 0;
772771
long startExecute = System.currentTimeMillis();
773772
while (true) {
@@ -787,10 +786,15 @@ private <T> T executeMutation(String tableName, MutationExecuteCallback<T> callb
787786
obPair = new ObPair<Long, ObTableParam>(0L, new ObTableParam(odpTable));
788787
} else {
789788
if (null != callback.getRowKey()) {
789+
if (tryTimes > 1) {
790+
TableEntry entry = getOrRefreshTableEntry(tableName, false, false, false);
791+
Long partId = getPartition(entry, callback.getRowKey());
792+
refreshTableLocationByTabletId(entry, tableName, getTabletIdByPartId(entry, partId));
793+
}
790794
// using row key
791795
obPair = getTable(tableName, callback.getRowKey(),
792796
needRefreshTableEntry, tableEntryRefreshIntervalWait,
793-
needFetchAllRouteInfo, route);
797+
false, route);
794798
} else if (null != callback.getKeyRanges()) {
795799
// using scan range
796800
obPair = getTable(tableName, new ObTableQuery(),
@@ -852,7 +856,7 @@ private <T> T executeMutation(String tableName, MutationExecuteCallback<T> callb
852856
((ObTableException) ex).getErrorCode(), ex.getMessage(),
853857
tryTimes);
854858
if (ex instanceof ObTableNeedFetchAllException) {
855-
needFetchAllRouteInfo = true;
859+
getOrRefreshTableEntry(tableName, needRefreshTableEntry, isTableEntryRefreshIntervalWait(), true);
856860
// reset failure count while fetch all route info
857861
this.resetExecuteContinuousFailureCount(tableName);
858862
}

0 commit comments

Comments
 (0)