@@ -414,11 +414,20 @@ private Row calculateRowKey(ObPair<Integer, ObTableSingleOp> operationPair) {
414414 return rowKey ;
415415 }
416416
417- private BatchIdxOperationPairList extractOperations (TabletOperationsMap tabletOperationsMap ) {
417+ private BatchIdxOperationPairList extractOperations (Map .Entry <Long , TabletOperationsMap > currentEntry ,
418+ Iterator <Map .Entry <Long , TabletOperationsMap >> iterator ) {
419+ // only reschedule operations from the current entry to avoid repeatedly executing operations
418420 BatchIdxOperationPairList operationsWithIndex = new BatchIdxOperationPairList ();
419- for (ObPair <ObTableParam , BatchIdxOperationPairList > pair : tabletOperationsMap .values ()) {
421+ TabletOperationsMap currentTabletMap = currentEntry .getValue ();
422+ for (ObPair <ObTableParam , BatchIdxOperationPairList > pair : currentTabletMap .values ()) {
420423 operationsWithIndex .addAll (pair .getRight ());
421424 }
425+ while (iterator .hasNext ()) {
426+ currentTabletMap = iterator .next ().getValue ();
427+ for (ObPair <ObTableParam , BatchIdxOperationPairList > pair : currentTabletMap .values ()) {
428+ operationsWithIndex .addAll (pair .getRight ());
429+ }
430+ }
422431 return operationsWithIndex ;
423432 }
424433
@@ -857,16 +866,17 @@ private void executeWithRetries(ObTableSingleOpResult[] results,
857866 }
858867 boolean allPartitionsSuccess = true ;
859868
860- for (Map .Entry <Long , TabletOperationsMap > currentEntry : currentPartitions .entrySet ()) {
869+ Iterator <Map .Entry <Long , TabletOperationsMap >> iterator = currentPartitions .entrySet ().iterator ();
870+ while (iterator .hasNext ()) {
871+ Map .Entry <Long , TabletOperationsMap > currentEntry = iterator .next ();
861872 try {
862873 partitionExecute (results , currentEntry );
863874 } catch (Exception e ) {
864875 if (shouldRetry (e )) {
865876 retryCount ++;
866877 errCode = ((ObTableNeedFetchMetaException ) e ).getErrorCode ();
867878 errMsg = e .getMessage ();
868- BatchIdxOperationPairList failedOperations = extractOperations (currentEntry
869- .getValue ());
879+ BatchIdxOperationPairList failedOperations = extractOperations (currentEntry , iterator ); // reschedule failed and sequent operations
870880 currentPartitions = prepareOperations (failedOperations );
871881 allPartitionsSuccess = false ;
872882 break ;
0 commit comments