|
22 | 22 | import static java.util.concurrent.TimeUnit.SECONDS;
|
23 | 23 |
|
24 | 24 | import java.io.IOException;
|
| 25 | +import java.io.InterruptedIOException; |
25 | 26 | import java.security.SecureRandom;
|
26 | 27 | import java.time.Duration;
|
27 | 28 | import java.util.ArrayList;
|
@@ -212,6 +213,8 @@ public static class ScanState {
|
212 | 213 |
|
213 | 214 | Duration busyTimeout;
|
214 | 215 |
|
| 216 | + volatile boolean closeInitiated = false; |
| 217 | + |
215 | 218 | TabletLocation getErrorLocation() {
|
216 | 219 | return prevLoc;
|
217 | 220 | }
|
@@ -508,8 +511,13 @@ public static List<KeyValue> scan(ClientContext context, ScanState scanState, Du
|
508 | 511 | TraceUtil.setException(child2, e, false);
|
509 | 512 | sleepMillis = pause(sleepMillis, maxSleepTime, scanState.runOnScanServer);
|
510 | 513 | } catch (TException e) {
|
511 |
| - TabletLocator.getLocator(context, scanState.tableId).invalidateCache(context, |
512 |
| - loc.tablet_location); |
| 514 | + boolean wasInterruptedAfterClose = |
| 515 | + e.getCause() != null && e.getCause().getClass().equals(InterruptedIOException.class) |
| 516 | + && scanState.closeInitiated; |
| 517 | + if (!wasInterruptedAfterClose) { |
| 518 | + TabletLocator.getLocator(context, scanState.tableId).invalidateCache(context, |
| 519 | + loc.tablet_location); |
| 520 | + } |
513 | 521 | error = "Scan failed, thrift error " + e.getClass().getName() + " " + e.getMessage()
|
514 | 522 | + " " + scanState.getErrorLocation();
|
515 | 523 | if (!error.equals(lastError)) {
|
|
0 commit comments