Running the following command:
pt-table-sync --print --bidirectional --databases db1 --tables test --conflict-column update_in --conflict-comparison greatest h=h1 h=h2
Left:
±—±--------------------±----------±---------+
| id | date_in | update_in | pet_name
±—±--------------------±----------±---------+
| 1 | 2013-09-13 13:41:52 | NULL | kitty
| 3 | 2013-09-13 13:41:52 | NULL | dog
| 5 | 2013-09-13 13:41:52 | NULL | tiger
±—±--------------------±----------±---------+
Right:
±—±--------------------±--------------------±------------+
| id | date_in | update_in | pet_name
±—±--------------------±--------------------±------------+
| 1 | 2013-09-13 13:41:52 | NULL | kitty
| 3 | 2013-09-13 13:41:52 | 2013-09-15 00:00:00 | dog_changed
| 5 | 2013-09-13 13:41:52 | NULL | tiger
±—±--------------------±--------------------±------------+
I do not get any results. The goal is to bring row 3 over from the right server because the update_in field is the greatest.
Running:
pt-table-sync --print --sync-to-master h=h1,D=db1,t=test
Gives me the correct REPLACE INTO
REPLACE INTO db1
.test
(id
, date_in
, update_in
, pet_name
) VALUES (‘3’, ‘2013-09-13 13:41:52’, ‘2013-09-15 00:00:00’, ‘dog_changed’)
What is the best approach to explicitly choosing the greatest specified date record using bidirectional?
Thank you,
-Matt