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

kv: stop using BeginTransaction requests #33566

Merged
merged 1 commit into from
Jan 10, 2019

Conversation

nvanbenschoten
Copy link
Member

Based on #33523.
Closes #25437.

This is the final part of addressing #32971.

The change gates the use of BeginTransaction on a cluster version. When a cluster's version is sufficiently high, it will stop sending them.

To make this work, a small change was needed for the detection of 1PC transactions. We now use sequence numbers to determine that a batch includes all of the writes in a transaction. This is in line with the proposal from the RFC's 1PC Transactions section and will work correctly with parallel commits.

Release note (performance improvement): Reduce the network and storage
overhead of multi-Range transactions.

@nvanbenschoten nvanbenschoten requested review from andreimatei, tbg and a team January 8, 2019 17:12
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner January 8, 2019 17:12
@nvanbenschoten nvanbenschoten requested a review from a team January 8, 2019 17:12
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/lazyPt3 branch 5 times, most recently from 68267f1 to 86e9a73 Compare January 9, 2019 07:18
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner January 9, 2019 07:18
@nvanbenschoten nvanbenschoten requested review from a team January 9, 2019 16:02
Copy link
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

LGTM

✌️

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


pkg/kv/txn_interceptor_heartbeat.go, line 54 at r1 (raw file):

	gatekeeper lockedSender

	st                *cluster.Settings

nit: I think we should do something better than passing a Settings object just to figure out if (and when) some version becomes active. This pattern is unfortunately used everywhere.
Take it or leave it.


pkg/roachpb/batch.go, line 242 at r1 (raw file):

		return false
	}
	nextSeq := int32(1)

mind adding a comment here saying in english that we're checking that seq numbers aren't skipped


pkg/settings/cluster/cockroach_versions.go, line 310 at r1 (raw file):

	},
	{
		// VersionLazyTxnRecord is TODO.

33566

Based on cockroachdb#33523.
Closes cockroachdb#25437.

This is the final part of addressing cockroachdb#32971.

The change gates the use of BeginTransaction on a cluster version.
When a cluster's version is sufficiently high, it will stop sending
them.

To make this work, a small change was needed for the detection of 1PC
transactions. We now use sequence numbers to determine that a batch
includes all of the writes in a transaction. This is in line with the
proposal from the RFC's `1PC Transactions` section and will work
correctly with parallel commits.

Release note (performance improvement): Reduce the network and storage
overhead of multi-Range transactions.
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.

TFTR!

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


pkg/kv/txn_interceptor_heartbeat.go, line 54 at r1 (raw file):

Previously, andreimatei (Andrei Matei) wrote…

nit: I think we should do something better than passing a Settings object just to figure out if (and when) some version becomes active. This pattern is unfortunately used everywhere.
Take it or leave it.

What specifically don't you like about the pattern? Seems better than having a global floating around.


pkg/roachpb/batch.go, line 242 at r1 (raw file):

Previously, andreimatei (Andrei Matei) wrote…

mind adding a comment here saying in english that we're checking that seq numbers aren't skipped

Done.


pkg/settings/cluster/cockroach_versions.go, line 310 at r1 (raw file):

Previously, andreimatei (Andrei Matei) wrote…

33566

Done.

Copy link
Contributor

@andreimatei andreimatei 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/kv/txn_interceptor_heartbeat.go, line 54 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

What specifically don't you like about the pattern? Seems better than having a global floating around.

I'd like something more specific to getting a version, that can easily be mocked out by tests.

Like, the reason why I've been sending the PRs around deleting migrations originated with me not wanting to pass some setting around, because those settings used to come from a Store and I was trying to divorce some code from the Store and make it more self-contained.
Anyway, not a big deal and not something that should hold up this PR in particular.

@nvanbenschoten
Copy link
Member Author

I verified that this passes upgrade/oldVersion=v2.1.3/nodes=5 as well.

bors r+

🤞

craig bot pushed a commit that referenced this pull request Jan 10, 2019
33566: kv: stop using BeginTransaction requests r=nvanbenschoten a=nvanbenschoten

Based on #33523.
Closes #25437.

This is the final part of addressing #32971.

The change gates the use of BeginTransaction on a cluster version. When a cluster's version is sufficiently high, it will stop sending them.

To make this work, a small change was needed for the detection of 1PC transactions. We now use sequence numbers to determine that a batch includes all of the writes in a transaction. This is in line with the proposal from the RFC's `1PC Transactions` section and will work correctly with parallel commits.

Release note (performance improvement): Reduce the network and storage
overhead of multi-Range transactions.

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

craig bot commented Jan 10, 2019

Build succeeded

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