pt-table-sync --replicate and --sync-to-master error "index does not exist"
Bug #1003014 reported by
Daniel Nichter
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Critical
|
Daniel Nichter | ||
2.0 |
Invalid
|
Undecided
|
Unassigned | ||
2.1 |
Fix Released
|
Critical
|
Daniel Nichter |
Bug Description
In certain cases, pt-table-sync --replicate <table> and/or --sync-to-master throws,
"Index PRIMARY does not exist in table at pt-table-sync line 9116"
but the PRIMARY key _does_ exist. Internally, the tbl_struct from the previous table is still being used which doesn't have a PK. Somehow the var isn't being updated from table to table.
Related branches
lp:~percona-toolkit-dev/percona-toolkit/fix-sync-index-bug-1003014
- Daniel Nichter: Approve
-
Diff: 236 lines (+209/-0)3 files modifiedbin/pt-table-sync (+18/-0)
t/pt-table-sync/bugs.t (+156/-0)
t/pt-table-sync/samples/wrong-tbl-struct-bug-1003014.sql (+35/-0)
lp:~percona-toolkit-dev/percona-toolkit/test-sync-index-bug-1003014
- Daniel Nichter: Approve
-
Diff: 200 lines (+191/-0)2 files modifiedt/pt-table-sync/bugs.t (+156/-0)
t/pt-table-sync/samples/wrong-tbl-struct-bug-1003014.sql (+35/-0)
description: | updated |
tags: | added: risk |
description: | updated |
summary: |
- pt-table-sync --replicate false-positive error "index does not exist" + pt-table-sync --replicate and --sync-to-master error "index does not + exist" |
To post a comment you must log in.
This bug only affects 2.1.1. 2.0 has different code that is not affected. Both versions have tests to prevent a regression.
This originated in 2.1.1 at https:/ /code.launchpad .net/~percona- toolkit- dev/percona- toolkit/ fix-table- status- bug-960513/ +merge/ 100295
2.0 has an inefficiency which is the point of https:/ /code.launchpad .net/~percona- toolkit- dev/percona- toolkit/ fix-table- status- bug-960513/ +merge/ 100296: it does SHOW CREATE TABLE for *every diff*. So if table foo has 100 diffs, the tool does SHOW CREATE TABLE foo 100 times. The change that caused this bug in 2.1.1 fixed that by only doing SHOW CREATE TALBE once. However, as the fix shows: it neglected to SHOW CREATE TABLE ever again, so the first table's def was used for every subsequent table. This could have potentially bad consequences/ side-effects because the tool uses columns, indexes, etc. from table foo to work on table bar. In most cases, this probably causes errors (undefined values, use of uninitialized values, SQL statement errors, etc.).