Skip to content

coldata: fix behavior of Vec.Append in some cases when NULLs are present#43720

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:vec-fix-append
Jan 15, 2020
Merged

coldata: fix behavior of Vec.Append in some cases when NULLs are present#43720
craig[bot] merged 1 commit intocockroachdb:masterfrom
yuzefovich:vec-fix-append

Conversation

@yuzefovich
Copy link
Copy Markdown
Member

@yuzefovich yuzefovich commented Jan 3, 2020

We would always Get and then Set a value while Append'ing without paying
attention to whether the value is actually NULL. This can lead to
problems in case of flat bytes if the necessary invariant is
unmaintained. Now this is fixed by explicitly enforcing the invariant.
Additionally, this commit ensures that the destination slice has the
desired capacity before appending one value at a time (in case of
a present selection vector).

I tried approach with paying attention to whether the value is NULL
before appending it and saw a significant performance hit, so I think
this approach is the least evil.

Fixes: #42774.

Release note: None

@yuzefovich yuzefovich requested review from a team and asubiotto January 3, 2020 21:42
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@yuzefovich yuzefovich force-pushed the vec-fix-append branch 2 times, most recently from 1e8ab9b to 9e9d73c Compare January 4, 2020 19:23
@yuzefovich yuzefovich changed the title coldata: fix behavior of Vec.Append when NULLs are present coldata: fix behavior of Vec.Append in some cases when NULLs are present Jan 4, 2020
Copy link
Copy Markdown
Contributor

@asubiotto asubiotto left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @yuzefovich)


pkg/col/coldata/vec_test.go, line 245 at r1 (raw file):

			dest.Append(sliceArgs)
		})
	}

We might want to consider adding an equality check at the end.

Copy link
Copy Markdown
Member Author

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @asubiotto)


pkg/col/coldata/vec_test.go, line 245 at r1 (raw file):

Previously, asubiotto (Alfonso Subiotto Marqués) wrote…

We might want to consider adding an equality check at the end.

Done.

We would always Get and then Set a value while Append'ing without paying
attention to whether the value is actually NULL. This can lead to
problems in case of flat bytes if the necessary invariant is
unmaintained. Now this is fixed by explicitly enforcing the invariant.
Additionally, this commit ensures that the destination slice has the
desired capacity before appending one value at a time (in case of
a present selection vector).

I tried approach with paying attention to whether the value is NULL
before appending it and saw a significant performance hit, so I think
this approach is the least evil.

Release note: None
Copy link
Copy Markdown
Contributor

@asubiotto asubiotto 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.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @asubiotto)

@yuzefovich
Copy link
Copy Markdown
Member Author

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 15, 2020

Build failed (retrying...)

craig bot pushed a commit that referenced this pull request Jan 15, 2020
43720: coldata: fix behavior of Vec.Append in some cases when NULLs are present r=yuzefovich a=yuzefovich

We would always Get and then Set a value while Append'ing without paying
attention to whether the value is actually NULL. This can lead to
problems in case of flat bytes if the necessary invariant is
unmaintained. Now this is fixed by explicitly enforcing the invariant.
Additionally, this commit ensures that the destination slice has the
desired capacity before appending one value at a time (in case of
a present selection vector).

I tried approach with paying attention to whether the value is NULL
before appending it and saw a significant performance hit, so I think
this approach is the least evil.

Fixes: #42774.

Release note: None

43933: backupccl: ensure restore on success is run once r=pbardea a=pbardea

It seems that jobs today do not ensure that the OnSuccess callback is
called exactly once. This PR moves the cleanup stages of RESTORE,
formerly located in the OnSuccess callback to be the final steps of
Resume. This should help ensure that these stages are run once and only
once.

Release note (bug fix): Ensure that RESTORE cleanup is run exactly once.

44013: roachtest: skip acceptance/version-upgrade because flaky r=andreimatei a=andreimatei

Very flaky, apparently because of some problem with a recent migration.
Touches #43957, #44005

Release note: None

Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
Co-authored-by: Paul Bardea <pbardea@gmail.com>
Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 15, 2020

Build succeeded

@craig craig bot merged commit aab7a0f into cockroachdb:master Jan 15, 2020
@yuzefovich yuzefovich deleted the vec-fix-append branch January 15, 2020 18:00
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.

sql/colexec: TestMergeJoiner failed under stress

3 participants