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

Prevent panic when dropping columns in schema merge #7821

Merged
merged 5 commits into from
May 8, 2024

Conversation

nicktobey
Copy link
Contributor

Fixes #7762

In certain cases, performing a schema merge when the merged schema had fewer columns than the base schema would cause a panic.

We actually had a test for this, but the test was disabled because a limitation in how the test harness generated column tags was causing incorrect detection of merge conflicts.

To re-enable these tests, this PR slightly relaxes the logic for merge conflicts wrt column tags. This is safe to do because column tags shouldn't influence the result of merges outside of helping to identify renamed columns, so long as the merge behaves the same in both directions.

…e and modified in the other: if the only change is the column tag, we allow the merge to proceed.

Tags are useful for detecting column renames, but should not otherwise affect the merge result.
@nicktobey nicktobey requested a review from zachmu May 4, 2024 01:44
@coffeegoddd
Copy link
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
63b8a89 ok 5937457
version total_tests
63b8a89 5937457
correctness_percentage
100.0

Copy link
Member

@zachmu zachmu left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -223,14 +223,14 @@ func OutputProllyNode(ctx context.Context, w io.Writer, node Node, ns NodeStore,
w.Write([]byte(", "))
}

isAddr := val.IsAddrEncoding(kd.Types[i].Enc)
Copy link
Member

Choose a reason for hiding this comment

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

This is kind of alarming, good catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this code only gets hit in tests, and only when tests fail. So we weren't seeing it.

@@ -717,13 +707,11 @@ var columnDefaultTests = []schemaMergeTest{
// one side changes columns, the other inserts rows
{
// TODO: this test silently does the wrong thing without erroring
Copy link
Member

Choose a reason for hiding this comment

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

TODO no longer accurate?

@coffeegoddd
Copy link
Contributor

@nicktobey DOLT

comparing_percentages
100.000000 to 100.000000
version result total
92c9d30 ok 5937457
version total_tests
92c9d30 5937457
correctness_percentage
100.0

@nicktobey nicktobey merged commit a8eb4e0 into main May 8, 2024
20 checks passed
@nicktobey nicktobey deleted the nicktobey/schema-merge branch May 8, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic during schema merge
3 participants