-
Notifications
You must be signed in to change notification settings - Fork 119
IndexingMerger: lessen work and retry by default #3732
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
aade484
06ff451
168a312
7633735
7b25720
0c27c3f
a1afad4
692f23a
9d09231
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
|
|
||
| package com.apple.foundationdb.record.provider.foundationdb; | ||
|
|
||
| import com.apple.foundationdb.FDBError; | ||
| import com.apple.foundationdb.FDBException; | ||
| import com.apple.foundationdb.annotation.API; | ||
| import com.apple.foundationdb.async.AsyncUtil; | ||
|
|
@@ -133,7 +134,7 @@ boolean mayRetryAfterHandlingException(@Nullable FDBException fdbException, | |
| @Nullable List<Object> additionalLogMessageKeyValues, | ||
| int currTries, | ||
| final boolean adjustLimits) { | ||
| if (currTries >= common.config.getMaxRetries() || !IndexingBase.shouldLessenWork(fdbException)) { | ||
| if (currTries >= common.config.getMaxRetries() || !shouldLessenWork(fdbException)) { | ||
| // Here: should not retry or no more retries. There is no real need to handle limits. | ||
| return false; | ||
| } | ||
|
|
@@ -144,6 +145,22 @@ boolean mayRetryAfterHandlingException(@Nullable FDBException fdbException, | |
| return true; | ||
| } | ||
|
|
||
| private static boolean shouldLessenWork(@Nullable FDBException ex) { | ||
| // These error codes represent a list of errors that can occur if there is too much work to be done | ||
| // in a single transaction. | ||
| if (ex == null) { | ||
| return false; | ||
| } | ||
| final Set<Integer> lessenWorkCodes = new HashSet<>(Arrays.asList( | ||
|
||
| FDBError.TIMED_OUT.code(), | ||
| FDBError.TRANSACTION_TOO_OLD.code(), | ||
| FDBError.NOT_COMMITTED.code(), | ||
| FDBError.TRANSACTION_TIMED_OUT.code(), | ||
| FDBError.COMMIT_READ_INCOMPLETE.code(), | ||
| FDBError.TRANSACTION_TOO_LARGE.code())); | ||
| return lessenWorkCodes.contains(ex.getCode()); | ||
| } | ||
|
|
||
| void decreaseLimit(@Nonnull FDBException fdbException, | ||
| @Nullable List<Object> additionalLogMessageKeyValues) { | ||
| // TODO: decrease the limit only for certain errors | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.