-
Notifications
You must be signed in to change notification settings - Fork 15
REP-5218 Roll back tasks as needed when restarting. #35
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
Conversation
|
Commenting here for posterity, this LGTM |
autarch
left a comment
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.
LGTM % I don't really have a ton of context on this code base.
|
|
||
| func (verifier *Verifier) doInMetaTransaction( | ||
| ctx context.Context, | ||
| todo func(context.Context, mongo.SessionContext) error, |
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.
nit: I think todo is not the best name, given how we use TODO comments in our code base.
tdq45gj
left a comment
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.
LGTM
b43dfb2 to
97f194c
Compare
The worker threads look for status=added tasks when finding work to do. When it grabs a task it sets status=processing; thus, no other threads will try to grab that task.
If the verifier crashes, though, any tasks that were status=processing need to be reset; otherwise no worker thread will ever pick them up, and the verifier will hang.
This changeset implements that reset of status=processing tasks so that the verifier will be able to finish after a restart.
Specifically:
processing, this means that the initial listing of namespaces was interrupted. Thus, we now reset the primary task toadded, and all other tasks are deleted.processing, that means we never finished writing out the collection’s partitions and checking its metadata. Any existing partition tasks are unusuable, so they get deleted, and the collection-verification task is reset toadded.processingpartition tasks are reset toadded.The use of transactions to do these rollbacks means that the verifier’s metadata can no longer be a standalone mongod.