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
WritePrepared: commit only from the 2nd queue #5014
WritePrepared: commit only from the 2nd queue #5014
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.
@maysamyabandeh has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@maysamyabandeh has updated the pull request. Re-import the pull request |
// Should the callback also publishes the commit seq number | ||
bool publish_seq_; | ||
// Auxiliary batch (if there is any) | ||
SequenceNumber aux_seq_; |
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 it'd be useful to explain the difference between aux_batch_cnt_ and data_batch_cnt_. From what I understand this only matters for two queues?
@@ -802,6 +809,11 @@ class WritePreparedCommitEntryPreReleaseCallback : public PreReleaseCallback { | |||
db_->AddCommitted(prep_seq_ + i, last_commit_seq); | |||
} | |||
} // else there was no prepare phase | |||
if (includes_aux_batch_) { | |||
for (size_t i = 0; i < aux_batch_cnt_; i++) { | |||
db_->AddCommitted(aux_seq_ + i, last_commit_seq); |
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.
Is the calculation of last_commit_seq
still correct in the presence of aux_seq_ (especially with data_batch_cnt_ > 1 case)? Can we add a comment explaining this?
@maysamyabandeh 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.
@maysamyabandeh is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This is a port of this PR into WriteUnprepared: facebook#5014 This also reverts this test change to restore some flaky write unprepared tests: facebook#5315 Tested with: $ gtest-parallel ./transaction_test --gtest_filter=MySQLStyleTransactionTest/MySQLStyleTransactionTest.TransactionStressTest/9 --repeat=128 [128/128] MySQLStyleTransactionTest/MySQLStyleTransactionTest.TransactionStressTest/9 (18250 ms)
Summary: This is a port of this PR into WriteUnprepared: #5014 This also reverts this test change to restore some flaky write unprepared tests: #5315 Tested with: $ gtest-parallel ./transaction_test --gtest_filter=MySQLStyleTransactionTest/MySQLStyleTransactionTest.TransactionStressTest/9 --repeat=128 [128/128] MySQLStyleTransactionTest/MySQLStyleTransactionTest.TransactionStressTest/9 (18250 ms) Pull Request resolved: #5439 Differential Revision: D15761405 Pulled By: lth fbshipit-source-id: ae2581fd942d8a5b3f9278fd6bc3c1ac0b2c964c
Summary: This is a port of this PR into WriteUnprepared: facebook#5014 This also reverts this test change to restore some flaky write unprepared tests: facebook#5315 Tested with: $ gtest-parallel ./transaction_test --gtest_filter=MySQLStyleTransactionTest/MySQLStyleTransactionTest.TransactionStressTest/9 --repeat=128 [128/128] MySQLStyleTransactionTest/MySQLStyleTransactionTest.TransactionStressTest/9 (18250 ms) Pull Request resolved: facebook#5439 Differential Revision: D15761405 Pulled By: lth fbshipit-source-id: ae2581fd942d8a5b3f9278fd6bc3c1ac0b2c964c
When two_write_queues is enabled we call ::AddPrepared only from the main queue, which writes to both WAL and memtable, and call ::AddCommitted from the 2nd queue, which writes only to WAL. This simplifies the logic by avoiding concurrency between AddPrepared and also between AddCommitted. The patch fixes one case that did not conform with the rule above. This would allow future refactoring. For example AdvaneMaxEvictedSeq, which is invoked by AddCommitted, can be simplified by assuming lack of concurrent calls to it.