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

engine: refine mvcc logic around moving intent timestamps #33468

Merged
merged 2 commits into from
Jan 30, 2019

Conversation

nvanbenschoten
Copy link
Member

This commit cleans up comments and logic in mvccResolveWriteIntent.

Release note: None

@nvanbenschoten nvanbenschoten requested review from tbg and a team January 3, 2019 18:12
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

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


pkg/storage/engine/mvcc.go, line 2217 at r1 (raw file):

	// after. We treat such intents as uncommitted.
	//
	// A commit with a newer timestamp than the intent means that our timestamp

This can't happen any more, right? We removed snapshot isolation and write at the provisional timestamp now, and we can't commit unless the provisional timestamp was the same for all writes. Assuming, of course, we're not in a migration where such things might still be carried out by other nodes.

Copy link
Member Author

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/storage/engine/mvcc.go, line 2217 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

This can't happen any more, right? We removed snapshot isolation and write at the provisional timestamp now, and we can't commit unless the provisional timestamp was the same for all writes. Assuming, of course, we're not in a migration where such things might still be carried out by other nodes.

I think it can still happen if we successfully refresh a transaction to avoid restarting and laying down all intents again.

Copy link
Member

@tbg tbg 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 r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained


pkg/storage/engine/mvcc.go, line 2159 at r1 (raw file):

		return false, err
	}
	// For cases where there's no value corresponding to the key we're

What do you think about

nextKeyIter := iter
iter = nil // prevent accidental use

and use nextKeyIter below? Or any other way you can add confidence that we don't accidentally move iter in the future.


pkg/storage/engine/mvcc.go, line 2217 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

I think it can still happen if we successfully refresh a transaction to avoid restarting and laying down all intents again.

Ah, of course. I forgot about refreshs. Worth adding to the comment that this is the only situation in which this happens nowadays.

This commit cleans up comments and logic in mvccResolveWriteIntent.

Release note: None
Release note: None
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/cleanUpMVCC branch from d3f1de8 to ea082c3 Compare January 29, 2019 15:54
Copy link
Member Author

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

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


pkg/storage/engine/mvcc.go, line 2159 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

What do you think about

nextKeyIter := iter
iter = nil // prevent accidental use

and use nextKeyIter below? Or any other way you can add confidence that we don't accidentally move iter in the future.

How's that? We were already doing it in one place below.

We could also take a *Iterator in unsafeNextVersion and nil it out in unsafeNextVersion, but that's kind of a strange contract.


pkg/storage/engine/mvcc.go, line 2217 at r1 (raw file):

Previously, tbg (Tobias Grieger) wrote…

Ah, of course. I forgot about refreshs. Worth adding to the comment that this is the only situation in which this happens nowadays.

Done.

Copy link
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2, 2 of 2 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)

@nvanbenschoten
Copy link
Member Author

bors r+

craig bot pushed a commit that referenced this pull request Jan 30, 2019
33468: engine: refine mvcc logic around moving intent timestamps r=nvanbenschoten a=nvanbenschoten

This commit cleans up comments and logic in mvccResolveWriteIntent.

Release note: None

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

craig bot commented Jan 30, 2019

Build succeeded

@craig craig bot merged commit ea082c3 into cockroachdb:master Jan 30, 2019
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/cleanUpMVCC branch January 30, 2019 23:07
@cockroachdb cockroachdb deleted a comment from craig bot Feb 5, 2019
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.

3 participants