-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
storage: remove MVCCIterator.Key method #98542
Conversation
The MVCCIterator interface previously exposed two methods for accessing the current iterator postion as a MVCC key—UnsafeKey and Key. Key() was equivalent of calling UnsafeKey().Clone(). This commit removes the Key() variant, pushing the onus of key copying onto the caller. This reduces the interface surface area, avoids accidental key copying (some of which is addressed within this key), and does not impose any unreasonable burden on callers. Epic; None Informs cockroachdb#82589. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only skimmed the non-test changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see this change.
All the changes here look fine, but just curious whether all tests are still using unsafeMVCCIterator
(or some equivalent) that will mangle the unsafe key?
Reviewed 33 of 33 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde and @rhu713)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the changes here look fine, but just curious whether all tests are still using unsafeMVCCIterator (or some equivalent) that will mangle the unsafe key?
Yeah, it now happens through the storage/pebbleiter.Iterator
type which performs the mangling right above the *pebble.Iterator
. It may also be worthwhile to perform analogous mangling directly above the top iterator returned from the storage package.
TFTRs!
bors r+
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde and @rhu713)
Build failed: |
Failed in UI tests:
bors r+ |
Build succeeded: |
The MVCCIterator interface previously exposed two methods for accessing the current iterator postion as a MVCC key—UnsafeKey and Key. Key() was equivalent to UnsafeKey().Clone().
This commit removes the Key() variant, pushing the onus of key copying onto the caller. This reduces the interface surface area, avoids accidental key copying (some of which is addressed within this commit), and does not impose any unreasonable burden on callers.
Epic: None
Informs #82589.
Release note: None