Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont retry operations when they can't succeed #33878

Closed
wants to merge 1 commit into from
Closed
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 @@ -512,7 +512,7 @@ public JobStatistics dryRunQuery(
queryConfig, MAX_RPC_RETRIES),
Sleeper.DEFAULT,
createDefaultBackoff(),
ALWAYS_RETRY)
DONT_RETRY_NOT_FOUND_OR_FORBIDDEN)
.getStatistics();
}

Expand Down Expand Up @@ -691,7 +691,7 @@ Table getTable(
updatedRef.getTableId(), MAX_RPC_RETRIES),
sleeper,
backoff,
DONT_RETRY_NOT_FOUND);
DONT_RETRY_NOT_FOUND_OR_FORBIDDEN);
} catch (IOException e) {
if (errorExtractor.itemNotFound(e)) {
return null;
Expand Down Expand Up @@ -835,7 +835,7 @@ boolean isTableEmpty(TableReference tableRef, BackOff backoff, Sleeper sleeper)
tableRef.getTableId(), MAX_RPC_RETRIES),
sleeper,
backoff,
DONT_RETRY_NOT_FOUND);
DONT_RETRY_NOT_FOUND_OR_FORBIDDEN);
return response.getRows() == null || response.getRows().isEmpty();
}

Expand All @@ -855,7 +855,7 @@ public Dataset getDataset(String projectId, String datasetId)
"Unable to get dataset: %s, aborting after %d retries.", datasetId, MAX_RPC_RETRIES),
Sleeper.DEFAULT,
createDefaultBackoff(),
DONT_RETRY_NOT_FOUND);
DONT_RETRY_NOT_FOUND_OR_FORBIDDEN);
}

/**
Expand Down Expand Up @@ -1570,10 +1570,10 @@ public void close() throws Exception {
}
}

static final SerializableFunction<IOException, Boolean> DONT_RETRY_NOT_FOUND =
static final SerializableFunction<IOException, Boolean> DONT_RETRY_NOT_FOUND_OR_FORBIDDEN =
input -> {
ApiErrorExtractor errorExtractor = new ApiErrorExtractor();
return !errorExtractor.itemNotFound(input);
return !errorExtractor.itemNotFound(input) && !errorExtractor.accessDenied(input);
};

static final SerializableFunction<IOException, Boolean> ALWAYS_RETRY = input -> true;
Expand Down
Loading