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

Forward port the various DeleteRange PRs #24

Merged

Conversation

petermattis
Copy link

@petermattis petermattis commented Dec 6, 2018

Also grabs c0f547b to fix a test failure with RepeatableThread (which doesn't appear to be used anywhere).

Fixes #22


This change is Reviewable

Yi Wu and others added 7 commits December 6, 2018 16:59
Summary:
When `MockTimeEnv` is used in test to mock time methods, we cannot use `CondVar::TimedWait` because it is using real time, not the mocked time for wait timeout. On Mac the method can return immediately without awaking other waiting threads, if the real time is larger than `wait_until` (which is a mocked time). When that happen, the `wait()` method will fall into an infinite loop.
Pull Request resolved: facebook#4560

Differential Revision: D10472851

Pulled By: yiwu-arbug

fbshipit-source-id: 898902546ace7db7ac509337dd8677a527209d19
BlockBasedTableIterator now maintains a current tombstone which is a
range of keys that are either all deleted in the sstable or all
non-deleted. It uses this key range to quickly skip over keys during
iteration. The check for non-deleted is pessimistic: a key lying within
a non-deleted tombstone range might be deleted by a more precise check
of the key's sequence number which is taken care of by the normal
RangeDelAggregator::ShouldDelete check in DBIter.
TableCache::NewIterator was failing to pass the file metadata to
BlockBasedTableReader::NewIterator, so all of the fancy code in
BlockBasedTableIterator to skip ranges of deleted keys was not being
used.

Changed BlockBasedTableIterator to represent range tombstone endpoints
that extend to infinity using a nullptr rather than an empty key. An
empty key is a valid key and doing anything with a key other than using
it for comparison using the user comparator is invalid.
CollapsedRangeDelMap::GetTombstone would previously return a *Slice that
pointed to a Slice within the map. This was dangerous, as a future call
to CollapsedRangeDelMap::AddTombstone could erase that slice. Teach
GetTombstone to make a copy of the slice that is safe to return.
Adjust the wording of the PartialRangeTombstone description to be more
precise about the fact that a nullptr start or end key represents an
infinite bound, not a non-existent bound.
Previously, when BlockBasedTableIterator::FindKeyForward seeked the
index forward, it failed to call SavePrevIndexValue. This could cause
InitDataBlock to fail to notice the updated index position and not load
the updated data block, resulting in missing keys.
Change `RangeDelAggregator::GetTombstone,ShouldDeleteRange` to take
internal keys instead of user keys.
@petermattis petermattis requested a review from benesch December 6, 2018 23:11
Copy link

@benesch benesch left a comment

Choose a reason for hiding this comment

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

🎉

@petermattis petermattis merged commit dc30625 into cockroachdb:crl-release-5.17.2 Dec 7, 2018
@petermattis petermattis deleted the pmattis/range-delete branch December 7, 2018 13:42
@ajkr ajkr mentioned this pull request Jun 26, 2019
32 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants