tikv/rocksdb

I think start is userkey here!

zgcbj opened this issue · 1 comments

zgcbj commented

(start == nullptr) ? GetSmallestUserKey() : ExtractUserKey(*start);

ExtractUserKey(*start) will assert false!

same to ExtractUserKey(*end)

Am I right?

Nice catch! Our unit tests didn't catch it because it will only be non-null when sub-compaction is involved.

The start is set here:

if (c->ShouldFormSubcompactions()) {
{
StopWatch sw(db_options_.clock, stats_, SUBCOMPACTION_SETUP_TIME);
GenSubcompactionBoundaries();
}
assert(sizes_.size() == boundaries_.size() + 1);
for (size_t i = 0; i <= boundaries_.size(); i++) {
Slice* start = i == 0 ? nullptr : &boundaries_[i - 1];

And the boundaries_ is set here:

boundaries_.emplace_back(ExtractUserKey(ranges[i].range.limit));

You're welcome to send us a fix~