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 slow path for MVCCResolveWriteIntentRange #81063

Merged
merged 1 commit into from
May 16, 2022

Conversation

sumeerbhola
Copy link
Collaborator

We no longer have physically interleaved intents, that needed the
slow path.

Release note: None

@sumeerbhola sumeerbhola requested review from nvanbenschoten and a team May 5, 2022 18:46
@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.

:lgtm:

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


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

			num++
		}
		if max > 0 && num == max {

Do we want to move this up right before // Parse the MVCCMetadata to see if it is a relevant intent.? Generally, resume spans start at the first key that could not be returned/processed, not at the key following the last key which was returned/processed. This avoids returning a resume span in cases where the limit exactly matches the number of keys in the span.

@sumeerbhola sumeerbhola force-pushed the resolution_cleanup branch from 0bed344 to 40549d8 Compare May 6, 2022 21:50
Copy link
Collaborator Author

@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.

TFTR!

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


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

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Do we want to move this up right before // Parse the MVCCMetadata to see if it is a relevant intent.? Generally, resume spans start at the first key that could not be returned/processed, not at the key following the last key which was returned/processed. This avoids returning a resume span in cases where the limit exactly matches the number of keys in the span.

Done

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.

Reviewed all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)


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

Previously, sumeerbhola wrote…

Done

We're still returning lastResolvedKey.Next(). Do we want to? Can we return sepIter.Key().Key (the key of the first unprocessed intent, if there is one)?

Also, can we move this after the if intent.Txn.ID != meta.Txn.ID { block?

@sumeerbhola sumeerbhola force-pushed the resolution_cleanup branch from 40549d8 to eaecc76 Compare May 9, 2022 13:31
@sumeerbhola sumeerbhola requested a review from a team as a code owner May 9, 2022 13:31
Copy link
Collaborator Author

@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.

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


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

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

We're still returning lastResolvedKey.Next(). Do we want to? Can we return sepIter.Key().Key (the key of the first unprocessed intent, if there is one)?

Also, can we move this after the if intent.Txn.ID != meta.Txn.ID { block?

  • I wanted to keep the same non-allocation behavior that was there before this change (may not be important).
  • The max checking happens after the previous intent has been resolved and sepIter has been stepped once. So from a wasted work perspective when resuming, returning lastResolvedKey.Next() or sepIter.Key().Key are equivalent, since seeking to either will place the iter in the same position.
  • If we moved the max checking to after if intent.Txn.ID != meta.Txn.ID we would definitely want to use sepIter.Key().Key to avoid wasting work when resuming. Given that there have been PRs (e.g.ExportRequest using ResourceLimiter) to bound the work performed in a KV request, I'm a bit wary of continuing doing work after the max has been reached. I realize that the current code is insufficient since there could already have been a large amount of iteration over other txns intents until we reached max.

The code prior to this refactor, for both the slow and fast path, would return a resume span even if the iterator was exhausted, which is why TestEvaluateBatch/ranged_intent_resolution_with_MaxSpanRequestKeys=3 failed. Now fixed.

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 1 of 1 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @sumeerbhola)

@sumeerbhola
Copy link
Collaborator Author

bors r=nvanbenschoten

@craig
Copy link
Contributor

craig bot commented May 9, 2022

Build failed:

@erikgrinaker
Copy link
Contributor

Taking the liberty of re-borsing this, since I'm working on implementing MVCC range tombstone handling in MVCCResolveWriteIntentRange.

bors retry

@craig
Copy link
Contributor

craig bot commented May 10, 2022

Build failed:

@erikgrinaker
Copy link
Contributor

Failed on TestChangefeedBackfillCheckpoint, but I stressed it for 500 runs locally without fail, so it's likely unrelated flake.

bors retry

craig bot pushed a commit that referenced this pull request May 10, 2022
81063: storage: remove slow path for MVCCResolveWriteIntentRange r=nvanbenschoten a=sumeerbhola

We no longer have physically interleaved intents, that needed the
slow path.

Release note: None

Co-authored-by: sumeerbhola <[email protected]>
@craig
Copy link
Contributor

craig bot commented May 10, 2022

Build failed:

@erikgrinaker
Copy link
Contributor

Different flake, TestInitRaftGroupOnRequest this time (which I'm on the hook for). Third time's the charm!

bors retry

@craig
Copy link
Contributor

craig bot commented May 11, 2022

Build failed:

@erikgrinaker
Copy link
Contributor

TestChangefeedBackfillCheckpoint again. It's possible there's something to look into here, since I'm not seeing it flake a lot elsewhere. Will stop pestering bors about this for now.

We no longer have physically interleaved intents, that needed the
slow path.

Release note: None
@sumeerbhola sumeerbhola force-pushed the resolution_cleanup branch from eaecc76 to add67e3 Compare May 11, 2022 12:40
@sumeerbhola
Copy link
Collaborator Author

Maybe it was unrelated, since CI is green now.

@sumeerbhola
Copy link
Collaborator Author

bors r=nvanbenschoten

@craig
Copy link
Contributor

craig bot commented May 13, 2022

Build failed:

@sumeerbhola
Copy link
Collaborator Author

flake in TestComposeGSSPython #76547

@sumeerbhola
Copy link
Collaborator Author

bors retry

@craig
Copy link
Contributor

craig bot commented May 13, 2022

Build failed:

@sumeerbhola
Copy link
Collaborator Author

another flake in TestComposeGSSPython

@sumeerbhola
Copy link
Collaborator Author

bors retry

@craig
Copy link
Contributor

craig bot commented May 16, 2022

Build succeeded:

@craig craig bot merged commit a5e3f4a into cockroachdb:master May 16, 2022
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.

4 participants