pt-table-sync --replicate and --sync-to-master error "index does not exist"

Bug #1003014 reported by Daniel Nichter
10
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

description: updated
tags: added: risk
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

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.).

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"
Revision history for this message
Baron Schwartz (baron-xaprb) wrote :

This may be related to bug 1003323.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-257

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers