GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

pt-table-sync --sync-to-mater option confused.

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

  • pt-table-sync --sync-to-mater option confused.

    in the document I saw the example
    Same as above but only resolve differences on slave1:
    pt-table-sync --execute --replicate test.checksum \ --sync-to-master slave1

    and in the follow description, the documentation said

    Be careful though: although this option specifies and syncs a single slave, if there are other slaves on the same master, they will receive via replication the changes intended for the slave that you’re trying to sync.

    so I want to know, whether add the option or not, all the slave will be sync ?
    does sync only one slave can be done with the --sync-to-master option?


  • #2
    When use --sync-to-master slave1, only the differences between slave1 and the master are the fix target. However, the tool does the sync by making changes on the master and so all slaves would receive the same queries.

    If the replication topology is master1, slave1, slave2, and table test.t1 has one id column with data as below:

    master1: 3 records, 1, 2, 3
    slave1: 1 record, 1
    slave2: 1 record, 2

    1) If you do
    pt-table-sync --execute --replicate test.checksum --sync-to-master slave1

    It would only attempt to sync slave1 to master1. The end result would be:

    master1: 1, 2, 3
    slave1: 1, 2, 3
    slave2: 2, 3

    Even if you didn't specify slave2 to be synced, it still receives the change sql and be affected.

    2) if you do
    pt-table-sync --execute --replicate test.checksum master1

    Then it would fix all slaves and the end result would be:
    master1: 1, 2, 3
    slave1: 1, 2, 3
    slave2: 1, 2, 3

    You can see the sql executed on the master by replacing --execute with --print.

    Hope this helps to clarify.

    Comment

    Working...
    X