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

pt-table-sync and syncing based on updateTime column

ErikEngerdErikEngerd EntrantCurrent User Role Beginner
Hi,

To implemenent an incremental database synchronization I am exploiting the fact that each row in our database has an updateTime column set.

So, my approach was to sync from a source database to a target using a where clause like 'updateTime > "2013-04-01"'. The source and target database are not related through a master slave relation. Also during the synchronization there is no traffic on both databases other than that from the synchronization.

What I am seeing now is that on the target database some rows are deleted when they should in fact be updated and I think I understand why.

Consider a row in the source database with updateTime < "2013-04-01". In the target database, the row has been updated so that updateTime > "2013-04-01". In this case, the where clause applied to the source will not list the row whereas on the target it does. The script then concludes that the row only exists on target and should be removed.

However, do you know of any way I could use the updateTime column with pt-table-sync to implement this synchronization?

Cheers
Erik

Comments

  • gmousegmouse Mod Squad Inactive User Role Beginner
    Maybe only run writes on the source?
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.