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

sql: make tests error if a leaf txn is not created when expected #112726

Merged

Conversation

rharding6373
Copy link
Collaborator

This adds a test-only error if a leaf transaction is expected to be used by a plan but a root transaction is used instead.

Epic: none
Informs: #111097

Release note: None

@rharding6373 rharding6373 requested a review from a team as a code owner October 19, 2023 21:32
@blathers-crl
Copy link

blathers-crl bot commented Oct 19, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

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


pkg/sql/distsql_running.go line 899 at r1 (raw file):

		return
	}
	if buildutil.CrdbTestBuild && txn != nil && localState.MustUseLeaf && flow.GetFlowCtx().Txn.Type() != kv.LeafTxn {

I think localState.MustUseLeaf is a function.

This adds a test-only error if a leaf transaction is expected to be used
by a plan but a root transaction is used instead.

Epic: none
Informs: cockroachdb#111097

Release note: None
@rharding6373 rharding6373 force-pushed the 20231011_udf_concurrent_txn_pt2_111097 branch from 2ef4e54 to a40a557 Compare October 20, 2023 15:50
Copy link
Collaborator Author

@rharding6373 rharding6373 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 @yuzefovich)


pkg/sql/distsql_running.go line 899 at r1 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

I think localState.MustUseLeaf is a function.

It's a bool, but I suppose it wouldn't hurt to change this check to use the function, so I've done so.

Copy link
Member

@yuzefovich yuzefovich 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, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rharding6373)


pkg/sql/distsql_running.go line 899 at r1 (raw file):

Previously, rharding6373 (Rachael Harding) wrote…

It's a bool, but I suppose it wouldn't hurt to change this check to use the function, so I've done so.

Oh, right, I was thinking about localState.MustUseLeafTxn().

@rharding6373
Copy link
Collaborator Author

bors r+

@craig
Copy link
Contributor

craig bot commented Oct 20, 2023

Build succeeded:

@craig craig bot merged commit 48baa96 into cockroachdb:master Oct 20, 2023
8 checks passed
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.

None yet

3 participants