@@ -520,6 +520,7 @@ private <T> T execute(String tableName, TableExecuteCallback<T> callback, ObServ
520520 throw new IllegalArgumentException ("table name is null" );
521521 }
522522 boolean needRefreshTableEntry = false ;
523+ boolean needFetchAllRouteInfo = false ;
523524 int tryTimes = 0 ;
524525 long startExecute = System .currentTimeMillis ();
525526 while (true ) {
@@ -539,7 +540,7 @@ private <T> T execute(String tableName, TableExecuteCallback<T> callback, ObServ
539540 obPair = new ObPair <Long , ObTableParam >(0L , new ObTableParam (odpTable ));
540541 } else {
541542 obPair = getTableBySingleRowKeyWithRoute (tableName , callback .getRowKey (),
542- needRefreshTableEntry , tableEntryRefreshIntervalWait , route );
543+ needRefreshTableEntry , tableEntryRefreshIntervalWait , needFetchAllRouteInfo , route );
543544 }
544545 T t = callback .execute (obPair );
545546 resetExecuteContinuousFailureCount (tableName );
@@ -588,6 +589,11 @@ private <T> T execute(String tableName, TableExecuteCallback<T> callback, ObServ
588589 "retry while meet Exception needing refresh, errorCode: {} , errorMsg: {},retry times {}" ,
589590 ((ObTableException ) ex ).getErrorCode (), ex .getMessage (),
590591 tryTimes );
592+ if (ex instanceof ObTableNeedFetchAllException ) {
593+ needFetchAllRouteInfo = true ;
594+ // reset failure count while fetch all route info
595+ this .resetExecuteContinuousFailureCount (tableName );
596+ }
591597 } else {
592598 calculateContinuousFailure (tableName , ex .getMessage ());
593599 throw ex ;
@@ -675,6 +681,7 @@ private <T> T executeMutation(String tableName, MutationExecuteCallback<T> callb
675681 throw new IllegalArgumentException ("table name is null" );
676682 }
677683 boolean needRefreshTableEntry = false ;
684+ boolean needFetchAllRouteInfo = false ;
678685 int tryTimes = 0 ;
679686 long startExecute = System .currentTimeMillis ();
680687 while (true ) {
@@ -696,12 +703,10 @@ private <T> T executeMutation(String tableName, MutationExecuteCallback<T> callb
696703 if (null != callback .getRowKey ()) {
697704 // using row key
698705 obPair = getTableBySingleRowKeyWithRoute (tableName , callback .getRowKey (),
699- needRefreshTableEntry , tableEntryRefreshIntervalWait , route );
706+ needRefreshTableEntry , tableEntryRefreshIntervalWait , needFetchAllRouteInfo , route );
700707 } else if (null != callback .getKeyRanges ()) {
701708 // using scan range
702- obPair = getTableByRowKeyRange (tableName , new ObTableQuery (),
703- callback .getKeyRanges (), needRefreshTableEntry ,
704- tableEntryRefreshIntervalWait , route );
709+ obPair = getTableByRowKeyRange (tableName , new ObTableQuery (), callback .getKeyRanges ());
705710 } else {
706711 throw new ObTableException ("rowkey and scan range are null in mutation" );
707712 }
@@ -754,6 +759,11 @@ private <T> T executeMutation(String tableName, MutationExecuteCallback<T> callb
754759 "retry while meet Exception needing refresh, errorCode: {} , errorMsg: {},retry times {}" ,
755760 ((ObTableException ) ex ).getErrorCode (), ex .getMessage (),
756761 tryTimes );
762+ if (ex instanceof ObTableNeedFetchAllException ) {
763+ needFetchAllRouteInfo = true ;
764+ // reset failure count while fetch all route info
765+ this .resetExecuteContinuousFailureCount (tableName );
766+ }
757767 } else {
758768 calculateContinuousFailure (tableName , ex .getMessage ());
759769 throw ex ;
@@ -1429,14 +1439,15 @@ private ReplicaLocation getPartitionLocation(TableEntry tableEntry, long partId,
14291439 * @param rowKey row key
14301440 * @param refresh whether to refresh
14311441 * @param waitForRefresh whether wait for refresh
1442+ * @param needFetchAll whether need fetch all
14321443 * @return ObPair of partId and table
14331444 * @throws Exception exception
14341445 */
14351446 public ObPair <Long , ObTableParam > getTableBySingleRowKey (String tableName , Object [] rowKey ,
1436- boolean refresh , boolean waitForRefresh )
1447+ boolean refresh , boolean waitForRefresh , boolean needFetchAll )
14371448 throws Exception {
14381449 ObServerRoute route = getRoute (false );
1439- return getTableBySingleRowKeyWithRoute (tableName , rowKey , refresh , waitForRefresh , route );
1450+ return getTableBySingleRowKeyWithRoute (tableName , rowKey , refresh , waitForRefresh , needFetchAll , route );
14401451 }
14411452
14421453 /**
@@ -1453,9 +1464,10 @@ public ObPair<Long, ObTableParam> getTableBySingleRowKeyWithRoute(String tableNa
14531464 Object [] rowKey ,
14541465 boolean refresh ,
14551466 boolean waitForRefresh ,
1467+ boolean needFetchAll ,
14561468 ObServerRoute route )
14571469 throws Exception {
1458- TableEntry tableEntry = getOrRefreshTableEntry (tableName , refresh , waitForRefresh , false );
1470+ TableEntry tableEntry = getOrRefreshTableEntry (tableName , refresh , waitForRefresh , needFetchAll );
14591471
14601472 long partId = getPartition (tableEntry , rowKey ); // partition id in 3.x, origin partId in 4.x, logicId
14611473
@@ -1466,14 +1478,10 @@ public ObPair<Long, ObTableParam> getTableBySingleRowKeyWithRoute(String tableNa
14661478 * For mutation (queryWithFilter)
14671479 * @param tableName table want to get
14681480 * @param keyRanges key
1469- * @param refresh whether to refresh
1470- * @param waitForRefresh whether wait for refresh
1471- * @param route ObServer route
14721481 * @return ObPair of partId and table
14731482 * @throws Exception exception
14741483 */
1475- public ObPair <Long , ObTableParam > getTableByRowKeyRange (String tableName , ObTableQuery query , List <ObNewRange > keyRanges , boolean refresh ,
1476- boolean waitForRefresh , ObServerRoute route )
1484+ public ObPair <Long , ObTableParam > getTableByRowKeyRange (String tableName , ObTableQuery query , List <ObNewRange > keyRanges )
14771485 throws Exception {
14781486 Map <Long , ObTableParam > partIdMapObTable = new HashMap <Long , ObTableParam >();
14791487 for (ObNewRange rang : keyRanges ) {
0 commit comments