-
Notifications
You must be signed in to change notification settings - Fork 130
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
mysql.go: data may not consistent when no pk but has uk #421
Conversation
cause by drainer using uk as where to update (where a1 = * and a3 is NULL), may update the wrong row when any column is null, it will not be index, so we can't use it unless all column of index is not null
/run-integration-test |
if we have multiple unique indices, we chose any one but it contains null column, maybe it's better to chose another one, do you read code in |
/run-all-tests |
a9c39dc
to
2bd6284
Compare
/run-all-tests |
@GregoryIan PTAL |
/run-all-tests |
please fix ci |
LGTM |
/run-all-tests |
} | ||
|
||
columns := make(map[string]*model.ColumnInfo) | ||
for _, col := range table.Columns { | ||
columns[col.Name.O] = col | ||
} | ||
|
||
for _, idx := range table.Indices { | ||
// put primary key at [0], so we get primary key first if table has primary key |
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.
this code seems can delete, it may make some confuse
/run-all-tests |
/run-integration-test |
/run-integration-test |
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
* mysql.go: data may not consistent when no pk but has uk cause by drainer using uk as where to update (where a1 = * and a3 is NULL), may update the wrong row when any column is null, it will not be index, so we can't use it unless all column of index is not null
* mysql.go: data may not consistent when no pk but has uk cause by drainer using uk as where to update (where a1 = * and a3 is NULL), may update the wrong row when any column is null, it will not be index, so we can't use it unless all column of index is not null
* mysql.go: data may not consistent when no pk but has uk cause by drainer using uk as where to update (where a1 = * and a3 is NULL), may update the wrong row when any column is null, it will not be index, so we can't use it unless all column of index is not null
* mysql.go: data may not consistent when no pk but has uk cause by drainer using uk as where to update (where a1 = * and a3 is NULL), may update the wrong row when any column is null, it will not be index, so we can't use it unless all column of index is not null
* mysql.go: data may not consistent when no pk but has uk cause by drainer using uk as where to update (where a1 = * and a3 is NULL), may update the wrong row when any column is null, it will not be index, so we can't use it unless all column of index is not null
What problem does this PR solve?
see https://internal.pingcap.net/jira/browse/TOOL-714
mysql.go: data may not consistent when no pk but has uk
cause by drainer using uk as where to update (where a1 = * and a3 is
NULL), may update the wrong row
when any column is null, it will not be index, so we can't use it unless
all column of index is not null
What is changed and how it works?
choose pk first, and check all column not null if use unique key, or use all columns
Check List
Tests
Code changes
Side effects
Related changes
kafka branch