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
Fix Released
Daniel Nichter
Fix Released
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

2.0 has an inefficiency which is the point of 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:

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

Other bug subscribers