Skip to content

sql: fix decoding error in fetcher#43002

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
rohany:decode-fix
Dec 17, 2019
Merged

sql: fix decoding error in fetcher#43002
craig[bot] merged 1 commit intocockroachdb:masterfrom
rohany:decode-fix

Conversation

@rohany
Copy link
Copy Markdown
Contributor

@rohany rohany commented Dec 5, 2019

Fixes #42992.

PR #42073 introduced column families for secondary indexes, but also introduced
a bug where if the extra columns of a unique index were included because that
row had a null value, then those extra columns needed to be skipped when
decoding keys. If the type of that extra column was not supported by the
vectorized engine, and internal error was thrown. This PR fixes the bug by
updating the key skipping logic to handle all valid types.

There is no release note because this was not a change visible
through major versions.

Release note: None

@rohany rohany requested review from a team and jordanlewis December 5, 2019 20:25
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@rohany
Copy link
Copy Markdown
Contributor Author

rohany commented Dec 5, 2019

@yuzefovich you've done some work in past with random tests / tests using all types -- do you know of something that could help test my change to SkipTableKey here?

Copy link
Copy Markdown
Member

@jordanlewis jordanlewis left a comment

Choose a reason for hiding this comment

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

Can you add tests for SkipTableKey under TestEncodeTableKey? It does a randomized property based test already, you can add the SkipTableKey by asserting that it skips the right number of bytes.

Code LGTM. The commit message looks like it's missing an opening sentence.

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

@rohany
Copy link
Copy Markdown
Contributor Author

rohany commented Dec 5, 2019

Added a test, PTAL!

Copy link
Copy Markdown
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.

Thanks for the quick fix!

Reviewed 6 of 6 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

Fixes cockroachdb#42992.

PR cockroachdb#42073 introduced column families for secondary indexes, but also introduced
a bug where if the extra columns of a unique index were included because that
row had a null value, then those extra columns needed to be skipped when
decoding keys. If the type of that extra column was not supported by the
vectorized engine, and internal error was thrown.  This PR fixes the bug by
updating the key skipping logic to handle all valid types.

There is no release note because this was not a change visible
through major versions.

Release note: None
@asubiotto
Copy link
Copy Markdown
Contributor

This affects any unsupported types that are part of a key, right? This probably needs to be backported with #42934

@rohany
Copy link
Copy Markdown
Contributor Author

rohany commented Dec 6, 2019

No that's #42999 -- though i think I need to wait for you to finish the backport of #42934

@asubiotto
Copy link
Copy Markdown
Contributor

OK, should I backport #42934 as it is and then let you backport that change separately?

@rohany
Copy link
Copy Markdown
Contributor Author

rohany commented Dec 17, 2019

bors r=jordanlewis

craig bot pushed a commit that referenced this pull request Dec 17, 2019
43002: sql: fix decoding error in fetcher r=jordanlewis a=rohany

Fixes #42992.

PR #42073 introduced column families for secondary indexes, but also introduced
a bug where if the extra columns of a unique index were included because that
row had a null value, then those extra columns needed to be skipped when
decoding keys. If the type of that extra column was not supported by the
vectorized engine, and internal error was thrown.  This PR fixes the bug by
updating the key skipping logic to handle all valid types.

There is no release note because this was not a change visible
through major versions.

Release note: None

Co-authored-by: Rohan Yadav <rohany@alumni.cmu.edu>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 17, 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.

sql: skipping extra columns in secondary index keys by the fetcher is broken

5 participants