Skip to content
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

Fixing blob db sequence number handling #2385

Closed
wants to merge 3 commits into from
Closed

Fixing blob db sequence number handling #2385

wants to merge 3 commits into from

Conversation

yiwu-arbug
Copy link
Contributor

Summary:
Blob db rely on base db returning sequence number through write batch after DB::Write(). However after recent changes to the write path, DB::Writ()e no longer return sequence number in some cases. Fixing it by have WriteBatchInternal::InsertInto() always encode sequence number into write batch.

Stacking on #2375.

Test Plan:
See the two new tests. DBWriteTest::ReturnSequenceNumber tests DB::Write() return sequence number through write batch. BlobDBTest::SequenceNumber tests the sequence number encoded in blob file is correct.

@facebook-github-bot
Copy link
Contributor

@yiwu-arbug has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@yiwu-arbug
Copy link
Contributor Author

@siying Mind take a look at the change to the core write path? Thanks!

@@ -919,7 +920,7 @@ Status BlobDBImpl::Write(const WriteOptions& opts, WriteBatch* updates) {
Writer::ConstructBlobHeader(&headerbuf, key, value, expiration, -1);

if (previous_put) {
impl->AppendSN(last_file, -1);
impl->AppendSN(last_file, 0 /*sequence number*/);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anirbanr-fb I'm using 0 instead of -1 for dummy sequence number here, since SequenceNumber is an unsigned integer. Will GC be fine with it?

Copy link
Contributor

@siying siying left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to approve it to unblock you. I think we should think twice about adding new DB test cases. This will increase the test run which is already in the edge of timing out in Travis.

break;
}
case kConcurrentMemTableWrite: {
options.allow_concurrent_memtable_write = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I remember correctly, this is true by default.

}
case kPipelinedWriteAndConcurrentMemTableWrite: {
options.enable_pipelined_write = true;
options.allow_concurrent_memtable_write = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since allow_concurrent_memtable_write is true by default, I think this is the same as the previous case.

@facebook-github-bot
Copy link
Contributor

@yiwu-arbug updated the pull request - view changes - changes since last import

@yiwu-arbug yiwu-arbug changed the base branch from yiwu_blob_test to master May 31, 2017 06:39
@facebook-github-bot
Copy link
Contributor

@yiwu-arbug updated the pull request - view changes - changes since last import

@facebook-github-bot
Copy link
Contributor

@yiwu-arbug has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@yiwu-arbug yiwu-arbug deleted the blob_sequence branch May 31, 2017 18:53
yiwu-arbug pushed a commit that referenced this pull request Jun 14, 2017
Summary:
Blob db rely on base db returning sequence number through write batch after DB::Write(). However after recent changes to the write path, DB::Writ()e no longer return sequence number in some cases. Fixing it by have WriteBatchInternal::InsertInto() always encode sequence number into write batch.

Stacking on #2375.
Closes #2385

Differential Revision: D5148358

Pulled By: yiwu-arbug

fbshipit-source-id: 8bda0aa07b9334ed03ed381548b39d167dc20c33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants