@@ -219,13 +219,14 @@ public void run() {
219
219
} catch (IOException e ) {
220
220
// The service itself failed . It may be an error coming from the communication
221
221
// layer, but, as well, a functional error raised by the server.
222
- receiveGlobalFailure (multiAction , server , numAttempt , e , true );
222
+
223
+ receiveGlobalFailure (multiAction , server , numAttempt , e );
223
224
return ;
224
225
} catch (Throwable t ) {
225
226
// This should not happen. Let's log & retry anyway.
226
227
LOG .error ("id=" + asyncProcess .id + ", caught throwable. Unexpected."
227
228
+ " Retrying. Server=" + server + ", tableName=" + tableName , t );
228
- receiveGlobalFailure (multiAction , server , numAttempt , t , true );
229
+ receiveGlobalFailure (multiAction , server , numAttempt , t );
229
230
return ;
230
231
}
231
232
if (res .type () == AbstractResponse .ResponseType .MULTI ) {
@@ -570,7 +571,6 @@ private RegionLocations findAllLocationsOrFail(Action action, boolean useCache)
570
571
*/
571
572
void sendMultiAction (Map <ServerName , MultiAction > actionsByServer , int numAttempt ,
572
573
List <Action > actionsForReplicaThread , boolean reuseThread ) {
573
- boolean clearServerCache = true ;
574
574
// Run the last item on the same thread if we are already on a send thread.
575
575
// We hope most of the time it will be the only item, so we can cut down on threads.
576
576
int actionsRemaining = actionsByServer .size ();
@@ -606,15 +606,14 @@ void sendMultiAction(Map<ServerName, MultiAction> actionsByServer, int numAttemp
606
606
LOG .warn ("id=" + asyncProcess .id + ", task rejected by pool. Unexpected." + " Server="
607
607
+ server .getServerName (), t );
608
608
// Do not update cache if exception is from failing to submit action to thread pool
609
- clearServerCache = false ;
610
609
} else {
611
610
// see #HBASE-14359 for more details
612
611
LOG .warn ("Caught unexpected exception/error: " , t );
613
612
}
614
613
asyncProcess .decTaskCounters (multiAction .getRegions (), server );
615
614
// We're likely to fail again, but this will increment the attempt counter,
616
615
// so it will finish.
617
- receiveGlobalFailure (multiAction , server , numAttempt , t , clearServerCache );
616
+ receiveGlobalFailure (multiAction , server , numAttempt , t );
618
617
}
619
618
}
620
619
}
@@ -764,13 +763,18 @@ private void failAll(MultiAction actions, ServerName server, int numAttempt,
764
763
* @param t the throwable (if any) that caused the resubmit
765
764
*/
766
765
private void receiveGlobalFailure (MultiAction rsActions , ServerName server , int numAttempt ,
767
- Throwable t , boolean clearServerCache ) {
766
+ Throwable t ) {
768
767
errorsByServer .reportServerError (server );
769
768
Retry canRetry = errorsByServer .canTryMore (numAttempt ) ? Retry .YES : Retry .NO_RETRIES_EXHAUSTED ;
769
+ boolean clearServerCache = ClientExceptionsUtil .isMetaClearingException (t );
770
770
771
771
// Do not update cache if exception is from failing to submit action to thread pool
772
772
if (clearServerCache ) {
773
773
cleanServerCache (server , t );
774
+
775
+ if (LOG .isTraceEnabled ()) {
776
+ LOG .trace ("Cleared meta cache for server {} due to global failure {}" , server , t );
777
+ }
774
778
}
775
779
776
780
int failed = 0 ;
@@ -779,12 +783,8 @@ private void receiveGlobalFailure(MultiAction rsActions, ServerName server, int
779
783
for (Map .Entry <byte [], List <Action >> e : rsActions .actions .entrySet ()) {
780
784
byte [] regionName = e .getKey ();
781
785
byte [] row = e .getValue ().get (0 ).getAction ().getRow ();
782
- // Do not use the exception for updating cache because it might be coming from
783
- // any of the regions in the MultiAction and do not update cache if exception is
784
- // from failing to submit action to thread pool
785
786
if (clearServerCache ) {
786
- updateCachedLocations (server , regionName , row ,
787
- ClientExceptionsUtil .isMetaClearingException (t ) ? null : t );
787
+ updateCachedLocations (server , regionName , row , t );
788
788
}
789
789
for (Action action : e .getValue ()) {
790
790
Retry retry =
0 commit comments