Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ public Entry<Key,Value> next() {
}

void close() {
// setting this so that some errors can be ignored
scanState.closeInitiated = true;
// run actual close operation in the background so this does not block.
context.executeCleanupTask(() -> {
synchronized (scanState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static java.util.concurrent.TimeUnit.SECONDS;

import java.io.IOException;
import java.io.InterruptedIOException;
import java.security.SecureRandom;
import java.time.Duration;
import java.util.ArrayList;
Expand Down Expand Up @@ -212,6 +213,8 @@ public static class ScanState {

Duration busyTimeout;

volatile boolean closeInitiated = false;

TabletLocation getErrorLocation() {
return prevLoc;
}
Expand Down Expand Up @@ -508,8 +511,13 @@ public static List<KeyValue> scan(ClientContext context, ScanState scanState, Du
TraceUtil.setException(child2, e, false);
sleepMillis = pause(sleepMillis, maxSleepTime, scanState.runOnScanServer);
} catch (TException e) {
TabletLocator.getLocator(context, scanState.tableId).invalidateCache(context,
loc.tablet_location);
boolean wasInterruptedAfterClose =
e.getCause() != null && e.getCause().getClass().equals(InterruptedIOException.class)
&& scanState.closeInitiated;
if (!wasInterruptedAfterClose) {
TabletLocator.getLocator(context, scanState.tableId).invalidateCache(context,
loc.tablet_location);
}
error = "Scan failed, thrift error " + e.getClass().getName() + " " + e.getMessage()
+ " " + scanState.getErrorLocation();
if (!error.equals(lastError)) {
Expand Down