MergeHelper::MergeUntil Can’t Call FullMerge function When the input entry consist of the same user_key
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
https://github.com/facebook/rocksdb/wiki/Merge-Operator-Implementation
As stated in the documentation:
when compaction was working, we need to stop the stacking and process the stack in any one of the following cases(whichever occurs first):
1. a Put/Delete is encountered - we call FullMerge(value or nullptr, stack)
2. End-of-key-history is encountered - we call FullMerge(nullptr, stack)
3. a Supporting operation (snapshot) is encountered - see below
4. End-of-file is encountered - see below
so,i call Merge function until the end and never call Put and Delete, when compaction happens, it will satisfy:
2. End-of-key-history is encountered - we call FullMerge(nullptr, stack)
Code implementation logic in:
db/merge_helper.cc -> MergeUntil
in the end, Determine whether to call FullMerge function based on a variable surely_seen_the_beginning, and surely_seen_the_beginning are determined by hit_the_next_user_key and at_bottom
for hit_the_next_user_key, It becomes true when the logic: (!user_comparator_->Equal(ikey.user_key, orig_ikey.user_key)) are met
For special situations:the input entry consist of the same user_key, and the input entry local in bottom level, it should call FullMerge, but the logic: (!user_comparator_->Equal(ikey.user_key, orig_ikey.user_key)) will not be satisfactory,so hit_the_next_user_key always be false and surely_seen_the_beginning be false too, so, FullMerge Not called。
Contributor guide
Assessment
This issue has not been assessed yet.