Skip to content

Conversation

@cbi42
Copy link
Member

@cbi42 cbi42 commented Feb 19, 2025

Summary: added merge support for WBWIMemTable. Most of the preparation work is done in #13387 and #13400. The main code change to support merge is in wbwi_memtable.cc to support reading the Merge value type. The rest of the changes are mostly comment change and tests.

Test plan:

  • new unit test
  • ran python3 ./tools/db_crashtest.py --txn blackbox --txn_write_policy=0 --commit_bypass_memtable_one_in=100 --test_batches_snapshots=0 --use_merge=1 for several runs.

assert(seq_inc == memtable_update_count + wbwi_count);
assert(wbwi_count > 0);
assert(last_sequence != kMaxSequenceNumber);
SequenceNumber lb = last_sequence + 1 - wbwi_count;
Copy link
Member Author

@cbi42 cbi42 Feb 19, 2025

Choose a reason for hiding this comment

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

The change here is to fix a bug where with two_write_queues, the assertion ub == last_sequence may not be true. The reason is that last_sequence is the last allocated sequence number. Between versions_->LastSequence() and last_sequence, there are sequence numbers allocated for this write, and potentially sequence numbers allocated for other writes through the second write queue that write to WAL only.

[Edited] I saw an assertion failure with assert(ub == last_sequence); in a local stress test run. I'm not sure why but if it happens again it should be caught by the assertions here too. The change here makes aims to make seqno assignment clearer.

@facebook-github-bot
Copy link
Contributor

@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@jowlyzhang jowlyzhang left a comment

Choose a reason for hiding this comment

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

LGTM, @cbi42 thanks for the PR!

@cbi42
Copy link
Member Author

cbi42 commented Feb 21, 2025

LGTM, @cbi42 thanks for the PR!

Thanks for the review!

@facebook-github-bot
Copy link
Contributor

@cbi42 merged this pull request in 3c2c268.

ybtsdst pushed a commit to ybtsdst/rocksdb that referenced this pull request Apr 27, 2025
Summary:
added merge support for WBWIMemTable. Most of the preparation work is done in facebook#13387 and facebook#13400. The main code change to support merge is in wbwi_memtable.cc to support reading the Merge value type. The rest of the changes are mostly comment change and tests.

Pull Request resolved: facebook#13410

Test Plan:
- new unit test
- ran `python3 ./tools/db_crashtest.py --txn blackbox  --txn_write_policy=0 --commit_bypass_memtable_one_in=100 --test_batches_snapshots=0 --use_merge=1` for several runs.

Reviewed By: jowlyzhang

Differential Revision: D69885868

Pulled By: cbi42

fbshipit-source-id: b127d95a3027dc35910f6e5d65f3409ba27e2b6b
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