fix: fix convergent add columns being flagged as conflicts#11026
Open
tanyongzhi wants to merge 1 commit into
Open
fix: fix convergent add columns being flagged as conflicts#11026tanyongzhi wants to merge 1 commit into
tanyongzhi wants to merge 1 commit into
Conversation
Member
|
Thanks for the contribution, @tanyongzhi . Sorry for the delay getting back to you, we didn't have a good process for monitoring outside PR submissions. Take a minute and 1) merge from the tip of main, and 2) fix the failing bats tests. When you have, please ping @fulghum who can do a review for you to get this merged in. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When both branches run an identical
ALTER TABLE ... ADD COLUMNwith aDEFAULT, Dolt was incorrectly flagging the merge as conflicted and
(under autocommit) silently rolling back any DML the side branch made
on the new column.
Two bugs were responsible:
checkSchemaConflicts(merge_schema.go) unconditionally appended aNameCollision conflict whenever a column existed on both sides but
not in the ancestor, without first checking whether the definitions
were identical. Added an
ours.Equals(*theirs)guard so convergentadds are recognised as conflict-free, consistent with
mergeColumnswhich already handled this correctly.
processColumn(merge_prolly_rows.go) treated any divergent valuesfor a column absent from the base as a conflict, even when one
side's value was simply the schema-backfill default. Added
getConvergentDefault, which evaluates the column's defaultexpression at conflict-check time and uses the result as a synthetic
base: a side whose value equals the default made no intentional
write and loses to the other side's explicit change.
Closes #10909