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

decider: ignore EnsureSafeSplitKey on error #43078

Merged
merged 1 commit into from
Dec 10, 2019

Conversation

tbg
Copy link
Member

@tbg tbg commented Dec 10, 2019

Fixes #42903.

Load based splitting would previously not split when EnsureSafeSplitKey
returns an error. However such an error only meant that the key in
question wasn't even a SQL key, which is the case most of the time,
at least in simple workloads such as kv (the SQL layer will send
single-element scans, but without specifying the column family).

No release note since not released.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg tbg requested a review from nvanbenschoten December 10, 2019 16:43
@tbg tbg mentioned this pull request Dec 10, 2019
19 tasks
Copy link
Member

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

:lgtm: though this would probably be pretty easy to test.

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

Fixes cockroachdb#42903.

Load based splitting would previously not split when EnsureSafeSplitKey
returns an error. However such an error only meant that the key in
question wasn't even a SQL key, which is the case most of the time,
at least in simple workloads such as kv (the SQL layer will send
single-element scans, but without specifying the column family).

No release note since not released.

Release note: None
@tbg
Copy link
Member Author

tbg commented Dec 10, 2019

You're right, test added. TFTR!

if err != nil {
key = nil
//
// Note that we ignore EnsureSafeSplitKey when it returns an error since
Copy link
Member

Choose a reason for hiding this comment

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

I don't get it - the comment above says that we don't want to allow mid-row splits and that SQL even crashes.. If this changed we should update that comment

Copy link
Member

Choose a reason for hiding this comment

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

Oh, or we know for sure that in the error case the key is "in-between" rows? Seems like we should fix EnsureSafeSplitKey to not return an error at all, or at least explain this in its comment

Copy link
Member Author

Choose a reason for hiding this comment

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

SQL sort of forces us to avoid mid-column family splits and we can't do so because you can't tell the column family suffix if you don't know the SQL schema. Also SQL issues plenty of scans that don't have the column family in the start key, so that's what the split finder sees. So when it sees a key that doesn't look like a SQL key, it has to assume that it doesn't cut columns in half, or it couldn't split most of the time (as we saw in the test this commit fixes). This probably holds but if you issued unfortunate batch requests you can definitely trick it into still splitting between col families.

I'm pretty unhappy about the situation in here and it seems reasonable to make SQL resilient to col families being split between ranges, not because I love that, but because I don't see any other way 😞

Copy link
Member

Choose a reason for hiding this comment

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

Bleah. I would put these details in an issue and mention the issue in the comment.

@tbg
Copy link
Member Author

tbg commented Dec 10, 2019

bors r=nvanbenschoten

craig bot pushed a commit that referenced this pull request Dec 10, 2019
43078: decider: ignore EnsureSafeSplitKey on error r=nvanbenschoten a=tbg

Fixes #42903.

Load based splitting would previously not split when EnsureSafeSplitKey
returns an error. However such an error only meant that the key in
question wasn't even a SQL key, which is the case most of the time,
at least in simple workloads such as kv (the SQL layer will send
single-element scans, but without specifying the column family).

No release note since not released.

Release note: None

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

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

roachtest: splits/load/uniform/nodes=3 failed
4 participants