Skip to content

opt: fix insert fast path uniqueness check bug#115654

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:115377-115378-fix-insert-fast-path-check
Dec 6, 2023
Merged

opt: fix insert fast path uniqueness check bug#115654
craig[bot] merged 1 commit intocockroachdb:masterfrom
mgartner:115377-115378-fix-insert-fast-path-check

Conversation

@mgartner
Copy link
Copy Markdown
Contributor

@mgartner mgartner commented Dec 5, 2023

This commit fixes a bug caused by creating a closure over an
incrementing integer in a loop.

Fixes #115377
Fixes #115378

Release note (bug fix): A bug has been fixed that caused node crashes
and panics when running INSERT queries on REGIONAL BY ROW tables
with UNIQUE constraints or indexes. The bug is only present in
version 23.2.0-beta.1.

@mgartner mgartner added the backport-23.2.x PAST MAINTENANCE SUPPORT: 23.2 patch releases via ER request only label Dec 5, 2023
@mgartner mgartner requested review from a team and rytaft December 5, 2023 21:45
@mgartner mgartner requested a review from a team as a code owner December 5, 2023 21:45
@mgartner mgartner requested review from michae2 and removed request for a team December 5, 2023 21:45
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@mgartner mgartner force-pushed the 115377-115378-fix-insert-fast-path-check branch from 372811d to 3aca545 Compare December 5, 2023 21:45
@mgartner mgartner changed the title opt: fix uniqueness check bug opt: fix insert fast path uniqueness check bug Dec 5, 2023
Copy link
Copy Markdown
Collaborator

@rytaft rytaft left a comment

Choose a reason for hiding this comment

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

:lgtm: great find!

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


pkg/sql/opt/exec/execbuilder/mutation.go line 202 at r1 (raw file):

		// Shadow "i" so that the closure below closes over a local copy of "i",
		// rather than closing over the incrementing "i".
		i := i

nit: why not just create a new variable with a different name? or perhaps do something like

uniqueCheck := &ins.UniqueChecks[i]

@mgartner mgartner force-pushed the 115377-115378-fix-insert-fast-path-check branch from 3aca545 to 5a44f76 Compare December 5, 2023 22:13
@mgartner mgartner requested a review from rytaft December 5, 2023 22:14
Copy link
Copy Markdown
Contributor Author

@mgartner mgartner 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 @michae2 and @rytaft)


pkg/sql/opt/exec/execbuilder/mutation.go line 202 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

nit: why not just create a new variable with a different name? or perhaps do something like

uniqueCheck := &ins.UniqueChecks[i]

Done.

@mgartner
Copy link
Copy Markdown
Contributor Author

mgartner commented Dec 5, 2023

TFTR!

bors r+

@mgartner
Copy link
Copy Markdown
Contributor Author

mgartner commented Dec 5, 2023

bors r-

need to fix commit message.

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 5, 2023

Canceled.

This commit fixes a bug caused by creating a closure over an
incrementing integer in a loop.

Fixes cockroachdb#115377
Fixes cockroachdb#115378

Release note (bug fix): A bug has been fixed that caused node crashes
and panics when running `INSERT` queries on `REGIONAL BY ROW` tables
with `UNIQUE` constraints or indexes. The bug is only present in
version 23.2.0-beta.1.
@mgartner mgartner force-pushed the 115377-115378-fix-insert-fast-path-check branch from 5a44f76 to 3303939 Compare December 5, 2023 22:46
@mgartner
Copy link
Copy Markdown
Contributor Author

mgartner commented Dec 5, 2023

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 6, 2023

Build succeeded:

@craig craig bot merged commit 9c5933a into cockroachdb:master Dec 6, 2023
msbutler pushed a commit to msbutler/cockroach that referenced this pull request Dec 6, 2023
115539: roachtest: allocate new cluster when c.Extend fails r=srosenberg a=DarrylWong

Previously, failure to extend the lifetime of a cluster would propagate to the worker and end up aborting the entire run. Now, we destroy the cluster and let it allocate a new one.

Fixes: cockroachdb#112509
Release note: none
Epic: none

115649: cluster-ui: remove leading `/` in settings request r=xinhaoz a=xinhaoz

Recently we required that all requests paths from cluster-ui do not start with `/` so that they may be used with any given subpath when constructing proxy requests.

We missed removing the prefix from the `settings` api which requests all cluster settings.

Release note: None

Epic: none

----------------------
Previously, this auto stats enabled label would show disabled even though auto stats collection is enabled. This is because this value comes from the settings request which was not being issued correctly.
https://www.loom.com/share/42847f2c63484a508a128c5808df7bdd

115654: opt: fix insert fast path uniqueness check bug r=mgartner a=mgartner

This commit fixes a bug caused by creating a closure over an
incrementing integer in a loop.

Fixes cockroachdb#115377
Fixes cockroachdb#115378

Release note (bug fix): A bug has been fixed that caused node crashes
and panics when running `INSERT` queries on `REGIONAL BY ROW` tables
with `UNIQUE` constraints or indexes. The bug is only present in
version 23.2.0-beta.1.

Co-authored-by: DarrylWong <darryl@cockroachlabs.com>
Co-authored-by: Xin Hao Zhang <xzhang@cockroachlabs.com>
Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
@mgartner mgartner deleted the 115377-115378-fix-insert-fast-path-check branch December 6, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-23.2.x PAST MAINTENANCE SUPPORT: 23.2 patch releases via ER request only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: internal error during fast path uniqueness check duplicate key violation sql: panic during fast path uniqueness check duplicate key violation

3 participants