Not the answer you need?
Register and ask your own question!

pt-table-sync tool not working

krishmysqldbakrishmysqldba EntrantCurrent User Role Beginner
Hi Team,

I have setup pt-table-checksum and pt-table-sync for fixing the data issues between master and slaves.
when i ran pt-table-checksum i found few tables were not sink with the master tables,then i fired pt-table-sync it's applied some inserts into that particular table.

Then in the next pt-table-checksum run i'm able to see the old table which had updated by the pt-table-sync(this shouldn't come right ?). what is reason of this ?

Below are the commands i'm using.

pt-table-checksum -u xxxx -pxxxx --replicate-check --databases db --replicate percona.checksum P=3306,h=Master IP

Output :

db tbl total_rows chunks
db tb11 60 1
db tbl3 38 1

Then i fired pt-table-sync,

pt-table-sync h=Master IP,P=3306,D="db",t="tbl1",u="xxxxx",p="xxxxx" h=Slave IP,P=3306 --print --no-check-trigger --no-foreign-key-checks --no-check-slave

Output : this fired few inserts on "tbl1" table

Then i fired pt-table-checksum again, but i could see the old output which i had seen before the pt-table-sync

pt-table-checksum -u xxxx -pxxxx --replicate-check --databases db --replicate percona.checksum P=3372,h=Master IP

Output :

db tbl total_rows chunks
db tb11 60 1
db tbl3 38 1

Please provide the solution of this ASAP.



  • psongpsong Contributor Inactive User Role Beginner

    The output from pt-table-checksum should look like below:
    10-20T08:36:50 0 0 200 1 0 0.005 db1.tbl1
    10-20T08:36:50 0 0 603 7 0 0.035 db1.tbl2
    The ERRORS and DIFFS columns are the ones to check for problems. What are these values from your check?

    Also the sync command you used,

    pt-table-sync h=Master IP,P=3306,D="db",t="tbl1",u="xxxxx",p="xxxxx" h=Slave IP,P=3306 --print --no-check-trigger --no-foreign-key-checks --no-check-slave

    would make changes directly on <Slave IP> specified. If you have other slaves, they would not be touched and if they are out-of-sync with the master, then when you run pt-table-checksum again, the diff would remain.

    The recommended way to sync master and all slaves is to use --replicate, e.g.

    pt-table-sync --print --replicate=percona.checksum --database=db --tables=tbl1 h=<master ip>,p=3306,u=user,p=passwd

    Does tbl1 have no primary key nor unique key? Is that why you choose --no-check-slave?
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.