storage: allow multiple iterators in pebbleReadOnly and pebbleBatch#81195
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom May 16, 2022
Merged
storage: allow multiple iterators in pebbleReadOnly and pebbleBatch#81195craig[bot] merged 1 commit intocockroachdb:masterfrom
pebbleReadOnly and pebbleBatch#81195craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Previously, `pebbleReadOnly` and `pebbleBatch` only supported a single concurrent iterator of a given type, as this iterator was reused between `NewMVCCIterator` calls. Attempts to create an additional iterator would panic with "iterator already in use". Time-bound iterators were excluded from this reuse, and always created from scratch, so they sidestepped this limitation. However, we will soon make these iterators reusable too via a new `SetOptions()` method in Pebble. When TBIs also become reusable, this will cause `MVCCIncrementalIterator` to panic with "iterator already in use", because it always creates two concurrent iterators: one regular and one time-bound. This patch therefore ensures all `Reader` implementations support multiple concurrent iterators, by cloning the existing cached iterator if it is already in use. This also preserves the pinned engine state for the new iterator. Release note: None
Member
This was referenced May 13, 2022
jbowens
approved these changes
May 16, 2022
Contributor
jbowens
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @aliher1911, @nicktrav, and @sumeerbhola)
Contributor
Author
|
TFTR! bors r=jbowens |
Contributor
|
Build succeeded: |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partial resubmit of #79291, which was merged into the mvcc-range-tombstones branch.
Previously,
pebbleReadOnlyandpebbleBatchonly supported a singleconcurrent iterator of a given type, as this iterator was reused between
NewMVCCIteratorcalls. Attempts to create an additional iterator wouldpanic with "iterator already in use".
Time-bound iterators were excluded from this reuse, and always created
from scratch, so they sidestepped this limitation. However, we will soon
make these iterators reusable too via a new
SetOptions()method inPebble. When TBIs also become reusable, this will cause
MVCCIncrementalIteratorto panic with "iterator already in use",because it always creates two concurrent iterators: one regular and one
time-bound.
This patch therefore ensures all
Readerimplementations supportmultiple concurrent iterators, by cloning the existing cached iterator
if it is already in use. This also preserves the pinned engine state for
the new iterator.
Release note: None