pt-table-checksum doesn't ignore tables for --replicate-check-only

Reported by John Ferlito on 2012-11-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit
High
Brian Fraser

Bug Description

I'm performing the following out of cron

pt-table-checksum master --replicate=pt.table_checksum --empty-replicate-table --quiet '--ignore-tables-regex=bad_table'

Then later I run

pt-table-checksum master --replicate=pt.table_checksum --empty-replicate-table '--ignore-tables-regex=bad_table' --replicate-check-only

I get the following output

Differences on slave-02
TABLE CHUNK CNT_DIFF CRC_DIFF CHUNK_INDEX LOWER_BOUNDARY UPPER_BOUNDARY
bad_database.bad_table 1 5 1

I would expect there to be no output

Daniel Nichter (daniel-nichter) wrote :

There might be two bugs here. The code block doing --replicate-check-only doesn't look at any of the filters, so that's one bug. The second bug is that since the table should have been ignored by the first run, it shouldn't exist for the second run, yet it seems to, so perhaps --ignore-tables-regex isn't working in general.

Changed in percona-toolkit:
status: New → Confirmed
tags: added: filters pt-table-checksum
Brian Fraser (fraserbn) on 2012-11-09
Changed in percona-toolkit:
assignee: nobody → Brian Fraser (fraserbn)
Brian Fraser (fraserbn) wrote :

I can only partially reproduce this.

If I run
$ pt-table-checksum master --replicate=pt.table_checksum --empty-replicate-table --quiet

and then

$ pt-table-checksum master --replicate=pt.table_checksum --empty-replicate-table '--ignore-tables-regex=bad_table' --replicate-check-only

I see the bug described; --replicate-check-only isn't using any of the filters, so the attached branch fixes that. However, the original bug had a --ignore-tables-regex=bad_table in the first invocation as well, but that works just fine here. John, could you post the steps to reproduce this, and if possible, the output of running the tool with PTDEBUG?

Changed in percona-toolkit:
status: Confirmed → In Progress
John Ferlito (johnf-inodes) wrote :

Hi Brian,

OK I've worked out what my real issue actually was. It is the way that --empty-replicate-table works. So apparently it empties the table as it checks each table just for that table.

So my workflow was

* run without the ignore
* bad_table now has entries in the checksums table
* run with the ignore
* It still complains because the values aren't deleted from the checksums table

I think the way --empty-replicate-table is non-intuitive. I would expect it to truncate the table so it is always starting afresh so old data can muck up the run.

Cheers,
John

Brian Fraser (fraserbn) on 2012-11-09
Changed in percona-toolkit:
milestone: none → 2.1.7
Brian Fraser (fraserbn) wrote :

Hi John,

You know, I was under the same impression about --empty-replicate-table. It definitely sounds unintuitive, but digging further, the current behavior is needed to make --resume work, so changing it is not an option. So instead, I attached a second branch to this bug with a doc patch emphasizing how --empty-replicate-table works, and pointing out that if users want a truly empty --replicate table, they'll have to manually run a TRUNCATE TABLE.

Not the best solution, but it might save someone our current headache.

Changed in percona-toolkit:
milestone: 2.1.7 → 2.1.8
Brian Fraser (fraserbn) on 2012-11-29
Changed in percona-toolkit:
status: In Progress → Fix Committed
Changed in percona-toolkit:
importance: Undecided → High
summary: - pt-table-checksum does't ignore tables for --replicate-check-only
+ pt-table-checksum doesn't ignore tables for --replicate-check-only
Changed in percona-toolkit:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers