Announcement Module
No announcement yet.

pt-table-sync, sync-to-master, replication, syncing tables on slave

Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • pt-table-sync, sync-to-master, replication, syncing tables on slave


    I have configured RBR and sometimes it is stopping on a low use myisam table. I am pretty sure that nobody is writing on that tabl (I am pretty sure that nobody is writing on any table on slave server, of course, one developer could have a mistake but now this option is discarded).

    I am receiving:
    Slave SQL: Could not execute Update_rows event on table DB.tbl; Can't find record in 'tbl', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log mysql-bin.729866, end_log_pos 79139511, Error_code: 1032

    This table is small so I could sync manually without problems. I know that I should know what is happening but this table is not important and I want to have in sync to continue with replication. Now I have started with SQL_SLAVE_SKIP_COUNTER=1. This is the situation.

    Now I want to know how to recover from that error using pt-table-sync without slave running.

    I have use the option --sync-to-master and --replication and I only get errors.

    pt-table-sync --execute --sync-to-master D=DBt=tbl,u=user,p=pwd localhost --print

    Now I get similar errors with slave running that I got with slave not running:
    Slave did not catch up to its master after waiting 60 seconds with MASTER_POS_WAIT. Try inceasing the --wait time, or disable this feature by specifying --wait 0. at /usr/bin/pt-table-sync line 5483. while doing Varios.reprogramaciones_tbl

  • #2
    Sounds like there is a lot of replication delay. pt-table-sync will require that replication is running and not delayed too much.


    • #3
      Yes, I executed pt-table-sync 2 hours later the error, so about 14 GB of binlog was generated. I use the option --wait 0 to get the statements to sync the table.

      To get sql statements I ignore the error because I have found the table and I can do that on this table because it is small and not very important but if I have a big table (100GB table or so...) How I could manage an error like this ? If pt-table-sync needs to have a slave running it is not so util like I thought... I am thinking on an corruption on a intensive used table, how to recover from an error like happens today ?


      • #4
        You can use it without the --sync-to-master or --replicate options and make changes on the replica directly, but you risk making conflicting changes. The tool is flexible enough to do what you need -- you might need to be more familiar with replication to use it effectively and safely in this scenario, though.