-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Add ordinal to merge schema after merge #2662
Conversation
@@ -118,6 +118,12 @@ func SchemaMerge(ourSch, theirSch, ancSch schema.Schema, tblName string) (sch sc | |||
if err != nil { | |||
return nil, sc, err | |||
} | |||
|
|||
err = sch.SetPkOrdinals(ourSch.GetPkOrdinals()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the three schemas have different pk ordinals? how to tell which one to keep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we do not support merge between tables with competing ordinals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a simpler unit test would have been helpful, the script test seems sufficient
Expected: []sql.Row{{1, 1, 1}, {2, 3, 2}, {2, 5, 2}}, | ||
}, | ||
{ | ||
Query: "/* client b */ insert into test values (4,3,2)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't strike me as the most direct way to test the change, but if it mimics the original customer issue then it make sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah without the change, this becomes an incorrect primary key issue and the ordering of the select changes. This indicates that primary key set has changed.
@@ -118,6 +118,14 @@ func SchemaMerge(ourSch, theirSch, ancSch schema.Schema, tblName string) (sch sc | |||
if err != nil { | |||
return nil, sc, err | |||
} | |||
|
|||
// TODO: We should enforce the existing primary key set pk ordinals as out of order primary | |||
// key ordinal merge is not supported yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"merge conflict should have blocked any ordinal change"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a simpler unit test would have been helpful, the script test seems sufficient
Still need to add test cases here