-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db: changes to make iterators respect the bounds specified by the caller
- Iterator ensures that keys used for seek respect both lower and upper bounds. - levelIter returns synthetic keys corresponding to the iterator bounds, when they are present, instead of the file bounds. Additionally, the mergingIter is told that it has done so using the isSyntheticIterBoundsKey field -- this prevents the mergingIter to get stuck at such a key when it becomes the top of the heap. The latter is needed to retrict the cases where the mergingIter breaks an invariant that the iterators below it will not be positioned more than one key outside the iterator bounds. Such an invariant is needed for a later change that will optimize seeks by using next. Say there is an upper bound k1, and the mergingIter breaks the invariant by positioning a levelIter at k3 > k1. This is acceptable only if any keys k2 such that k1 < k2 < k3 are deleted by a range tombstone. The old code returned the file bounds as the synthetic keys which could be arbitrarily far away from the iterator bounds. Using the above example, it could have returned k3. If k3 becomes the top element of the heap, and happens to be deleted by a tombstone [k3, k4) (the tombstone would be at a higher level), the code would seek to k4, while k2 was not deleted, which means iterators can be more than one (internal) key outide the iterator bounds.
- Loading branch information
1 parent
91e8175
commit 879f3bf
Showing
9 changed files
with
112 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.