-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
WriteUnPrepared: Fix bug in savepoints #5703
Conversation
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.
@lth has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@@ -729,7 +736,6 @@ Status WriteUnpreparedTxn::RollbackToSavePointInternal() { | |||
assert(flushed_save_points_->size() > 0); | |||
WriteUnpreparedTxn::SavePoint& top = flushed_save_points_->back(); | |||
|
|||
assert(top.unprep_seqs_.size() > 0); |
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.
Why is this assert removed?
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.
This is removed because now we may skip flushing a write batch, if that write batch is empty, but we still want to save the savepoint.
If we set savepoint right after begin transaction, then when we flush the write batch, the first savepoint would not have any unprep_seqs because no flush was done.
@lth has updated the pull request. Re-import the pull request |
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.
@lth has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@lth has updated the pull request. Re-import the pull request |
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.
@lth has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: Fix a bug in write unprepared savepoints. When flushing the write batch according to savepoint boundaries, we were forgetting to flush the last write batch after the last savepoint, meaning that some data was not written to DB. Also, add a small optimization where we avoid flushing empty batches. Pull Request resolved: facebook#5703 Differential Revision: D16811996 Pulled By: lth fbshipit-source-id: 600c7e0e520ad7a8fad32d77e11d932453e68e3f
Fix a bug in write unprepared savepoints. When flushing the write batch according to savepoint boundaries, we were forgetting to flush the last write batch after the last savepoint, meaning that some data was not written to DB.
Also, add a small optimization where we avoid flushing empty batches.