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

storage: remove MVCCIterator.Key method #98542

Merged
merged 1 commit into from
Mar 14, 2023
Merged

Conversation

jbowens
Copy link
Collaborator

@jbowens jbowens commented Mar 13, 2023

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

@cockroach-teamcity
Copy link
Member

This change is Reviewable

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
@jbowens jbowens marked this pull request as ready for review March 14, 2023 00:54
@jbowens jbowens requested review from a team as code owners March 14, 2023 00:54
@jbowens jbowens requested a review from a team March 14, 2023 00:54
@jbowens jbowens requested a review from a team as a code owner March 14, 2023 00:54
@jbowens jbowens requested a review from a team March 14, 2023 00:54
@jbowens jbowens requested a review from a team as a code owner March 14, 2023 00:54
@jbowens jbowens requested review from RaduBerinde, rhu713, michae2, erikgrinaker and a team and removed request for a team March 14, 2023 00:54
@michae2 michae2 removed request for a team and michae2 March 14, 2023 03:36
Copy link
Contributor

@erikgrinaker erikgrinaker left a 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.

Copy link
Collaborator

@sumeerbhola sumeerbhola left a 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?

:lgtm:

Reviewed 33 of 33 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde and @rhu713)

Copy link
Collaborator Author

@jbowens jbowens left a 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: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @RaduBerinde and @rhu713)

@craig
Copy link
Contributor

craig bot commented Mar 14, 2023

Build failed:

@jbowens
Copy link
Collaborator Author

jbowens commented Mar 14, 2023

Failed in UI tests:

[15:54:28][Step 3/4] The build Tests::UI Test #47064 {buildId=9064827} has been running for more than 25 minutes. Terminating... 
[15:54:28][Step 3/4] Execution timeout
[15:54:28][Step 3/4] Stopping build on agent. Reason: build execution timeout
[15:54:28][Step 3/4] Dumping threads before termination:
[15:54:28][Step 3/4] PID: 4770, PPID: 1298, Command line: bash /home/agent/temp/agentTmp/custom_script10664969836098975994
[15:54:28][Step 3/4] No thread dump is available: Cannot detect running java processes: jps tool not found
[15:54:28][Step 3/4] 
[15:54:28][Step 3/4] PID: 4771, PPID: 4770, Command line: bash ./build/teamcity/cockroach/ci/tests/ui_test.sh
[15:54:28][Step 3/4] No thread dump is available: Cannot detect running java processes: jps tool not found
[15:54:28][Step 3/4] 
[15:54:28][Step 3/4] PID: 4785, PPID: 4771, Command line: docker run -i --rm --init -u 1003:1004 --workdir=/go/src/github.com/cockroachdb/cockroach --volume /home/agent/system/git:/home/agent/system/git:ro --volume /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts:/artifacts --volume /home/agent/work/.go/src/github.com/cockroachdb/cockroach:/go/src/github.com/cockroachdb/cockroach --volume /home/agent/.bzlhome:/home/roach cockroachdb/bazel:20230303-060247 build/teamcity/cockroach/ci/tests/ui_test_impl.sh
[15:54:28][Step 3/4] No thread dump is available: Cannot detect running java processes: jps tool not found
[15:54:28][Step 3/4] 
[15:54:28][Run UI tests] Terminated
[15:54:28][Run UI tests] Process exited with code 143

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 14, 2023

Build succeeded:

@craig craig bot merged commit a36d88b into cockroachdb:master Mar 14, 2023
@jbowens jbowens deleted the rm-key branch March 14, 2023 21:00
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.

5 participants