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: Refactor resolve write intent options #94764

Merged

Conversation

KaiSun314
Copy link
Contributor

In this PR, we add MVCCResolveWriteIntentOptions to MVCCResolveWriteIntent and MVCCResolveWriteIntentRangeOptions to MVCCResolveWriteIntentRange. Moreover, we additionally return numBytes and resumeSpan in MVCCResolveWriteIntent and numBytes and resumeReason in MVCCResolveWriteIntentRange, but these return values are currently unused and serve as a placeholder in refactoring, but will be used in the future.

Informs: #77228

Release note: None

@blathers-crl
Copy link

blathers-crl bot commented Jan 5, 2023

Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

I have added a few people who may be able to assist in reviewing:

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels Jan 5, 2023
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

👋 thanks!

Reviewed 16 of 16 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @erikgrinaker and @KaiSun314)


pkg/storage/mvcc.go line 4811 at r1 (raw file):

	if opts.MaxKeys < 0 {
		resumeSpan := intent.Span // don't inline or `intent` would escape to heap
		return 0, 0, &resumeSpan, roachpb.RESUME_UNKNOWN, nil

nit: It's slightly more idiomatic to return 0 instead of roachpb.RESUME_UNKNOWN in these cases, because the zero value of the enum is usable.


pkg/storage/mvcc.go line 4857 at r1 (raw file):

		if opts.MaxKeys > 0 && numKeys == opts.MaxKeys {
			// We could also compute a tighter nextKey here if we wanted to.
			return numKeys, 0, &roachpb.Span{Key: lastResolvedKey.Next(), EndKey: intentEndKey}, roachpb.RESUME_UNKNOWN, nil

Should this be RESUME_KEY_LIMIT?

@KaiSun314 KaiSun314 force-pushed the add-resolve-write-intent-options branch from f2f6c10 to dca422f Compare January 5, 2023 19:49
@blathers-crl
Copy link

blathers-crl bot commented Jan 5, 2023

Thank you for updating your pull request.

My owl senses detect your PR is good for review. Please keep an eye out for any test failures in CI.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

Copy link
Contributor Author

@KaiSun314 KaiSun314 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @erikgrinaker and @nvanbenschoten)


pkg/storage/mvcc.go line 4857 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Should this be RESUME_KEY_LIMIT?

I was thinking in this PR, I would always return 0 for the resumeReason and comment that resumeReason is currently unused (to ensure this PR is purely refactoring). In the next PR that adds byte pagination, I will return the appropriate RESUME_KEY_LIMIT / RESUME_BYTE_LIMIT.

@KaiSun314 KaiSun314 marked this pull request as ready for review January 5, 2023 20:06
@KaiSun314 KaiSun314 requested a review from a team as a code owner January 5, 2023 20:06
@KaiSun314 KaiSun314 requested a review from a team January 5, 2023 20:06
@KaiSun314 KaiSun314 requested a review from a team as a code owner January 5, 2023 20:06
Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @erikgrinaker and @KaiSun314)


pkg/storage/mvcc.go line 4857 at r1 (raw file):

Previously, KaiSun314 (Kai Sun) wrote…

I was thinking in this PR, I would always return 0 for the resumeReason and comment that resumeReason is currently unused (to ensure this PR is purely refactoring). In the next PR that adds byte pagination, I will return the appropriate RESUME_KEY_LIMIT / RESUME_BYTE_LIMIT.

I slightly prefer returning RESUME_KEY_LIMIT here, because that's the resume reason. Each PR should stand on its own, and this one is arguably incorrect if it doesn't report the correct resume reason. Put another way, if we don't want to return a resume reason in this PR, it shouldn't be part of the function signature at all yet.

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.

I did a quick read -- nothing to add beyond @nvanbenschoten's existing comment.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @erikgrinaker and @KaiSun314)

@erikgrinaker erikgrinaker removed their request for review January 10, 2023 12:27
In this PR, we add MVCCResolveWriteIntentOptions to
MVCCResolveWriteIntent and MVCCResolveWriteIntentRangeOptions to
MVCCResolveWriteIntentRange. Moreover, we additionally return numBytes
and resumeSpan in MVCCResolveWriteIntent and numBytes and resumeReason
in MVCCResolveWriteIntentRange, but these return values are currently
unused and serve as a placeholder in refactoring, but will be used in
the future.

Informs: cockroachdb#77228

Release note: None
@KaiSun314 KaiSun314 force-pushed the add-resolve-write-intent-options branch from dca422f to aa3e37c Compare January 10, 2023 14:19
@KaiSun314
Copy link
Contributor Author

Thank you so much for the review Nathan and Sumeer!

bors r=nvanbenschoten, sumeerbhola

@craig
Copy link
Contributor

craig bot commented Jan 10, 2023

🔒 Permission denied

Existing reviewers: click here to make KaiSun314 a reviewer

@erikgrinaker
Copy link
Contributor

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 10, 2023

This PR was included in a batch that successfully built, but then failed to merge into master. It will not be retried.

Additional information:

@erikgrinaker
Copy link
Contributor

Bors is pretty messed up atm. Let's try again tomorrow.

@erikgrinaker
Copy link
Contributor

Let's try this again.

bors r+ single on

@craig
Copy link
Contributor

craig bot commented Jan 11, 2023

Build succeeded:

@craig craig bot merged commit 4d56ed0 into cockroachdb:master Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-community Originated from the community X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants