-
Notifications
You must be signed in to change notification settings - Fork 0
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
s192 - Perform retries on runTask/updateTask #33
Conversation
lockAcquisition.commit(); | ||
|
||
// actual task execution | ||
runAndUpdateTask(jobState.getShardedJobId(), taskId, sequenceNumber, jobState, taskState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was triggering the DatastoreException, not being caught, so reaching the servlet execution
ShardRetryState<T> retryState = null; | ||
Transaction postRunUpdate = null; //txn limited to 60s, so can't open this before run() call | ||
|
||
RetryType retryType = RetryType.NONE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reorganized the code, so all the handle failures happens at the end, and with retries
} catch (Throwable ex) { | ||
postRunUpdate = getDatastore().newTransaction(); | ||
t = ex; | ||
retryType = RetryType.SLICE; // this was originally shard, but seems like a mistake |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this change:
- message (slice error) and action (shard failure) were inconsistent
- probably makes sense to handle it as slice failure rather than prematurely kill the shard?
} | ||
rollbackIfActive(postRunUpdate); | ||
RetryExecutor.call(FOREVER_RETRYER, () -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the finally, perform the handle error (if any) + update task
Fixes
javax.servlet.ServletException: com.google.cloud.datastore.DatastoreException: Optimstic transaction was aborted
Try to better control places were commits are done and apply retries if needed.
Change implications