Mysql – how to make sure pt-sync-table data is the latest

MySQLperconapt-table-checksum

the first step is to checksum difference and record into percona.checksum table

pt-table-checksum h=xx,P=xx,u=xx,p=xx method=dsn=h=xx,D=xx,t=xx --databases=kobe

the second step is to print the repair SQL into a file

pt-table-sync --print --sync-to-master h=xx,P=xx,u=xx,p=xx >repair.sql

and I need to take this repairsql file to developers,show them how many records are difference, difference detail, and let them make sure。Ater that
I execute the repair sql

so my question is what I execute this old repair SQL, the new data is inserting ,and the new difference is creating, maybe this old repair SQL will cover the latest data !

can anybody help me ? thank you !

Best Answer

Use the --where option

Do only rows matching this WHERE clause. You can use this option to limit the checksum to only part of the table. This is particularly useful if you have append-only tables and don’t want to constantly re-check all rows; you could run a daily job to just check yesterday’s rows, for instance.

This option is much like the -w option to mysqldump. Do not specify the WHERE keyword. You might need to quote the value. Here is an example:

pt-table-checksum --where "ts > CURRENT_DATE - INTERVAL 1 DAY"

Source: https://www.percona.com/doc/percona-toolkit/2.2/pt-table-checksum.html#cmdoption-pt-table-checksum--where