pt-table-sync and syncing based on updateTime column


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?


Maybe only run writes on the source?