Skip to content
  • Libing Song's avatar
    a5096d83
    WL#7169 Semisync: make master wait for more than one slave to ack back · a5096d83
    Libing Song authored
    DESCRIPTION
    ===========
    This feature makes semisync master waits until receiving acknowledgements
    from more than one slaves. It guarantees the events are already replicated
    to more than one slaves when the transaction commit sucessfully.
    
    How many slaves it should wait are controlled by the new semisync master
    system variable "rpl_semi_sync_master_wait_slaves". Its values can be
    between 1 and 32. The default value is 1 and it can be changed dynamically.
    
    DESIGN
    ======
    Received acknowledgements are mantained in an array that its size is
    equal to rpl_semi_sync_master_wait_slaves - 1. Any semisync slave takes only
    one slot and only the latest ack of the slave is recorded. Each slot
    includes three items, they are server_id, binlog_name and binlog_position.
    
    If an ack should be inserted in the array and it is full, then the events
    before minimum ack in the array are replicated to enough slaves. So it will
    find the minimum ack in the array and report it to the module(which will update
    replied ack and wake up transactions) and remove the minimum ack from the array.
    
    Suppose rpl_semi_sync_master_wait_slaves = 4.
    
    coming acks          slot 1          slot 2           slot 3
    ===========          ==========      ==========       ==========
    1:log1:120           1:log1:120
    2:log1:120           1:log1:120      2:log1:120
    1:log1:150           1:log1:150      2:log1:120
    3:log1:120           1:log1:150      2:log1:120       3:log1:120
    
    4:log1:150           It is full. The minimum ack is log1:120. It is reported
                         and removed from the array. and the coming ack is added
                         into the array if it is greater than minimum ack.
                         Now the array looks like:
    
    coming acks          slot 1          slot 2           slot 3
    ===========          ==========      ==========       ==========
                         1:log1:150      4:log1:150
    a5096d83
    WL#7169 Semisync: make master wait for more than one slave to ack back
    Libing Song authored
    DESCRIPTION
    ===========
    This feature makes semisync master waits until receiving acknowledgements
    from more than one slaves. It guarantees the events are already replicated
    to more than one slaves when the transaction commit sucessfully.
    
    How many slaves it should wait are controlled by the new semisync master
    system variable "rpl_semi_sync_master_wait_slaves". Its values can be
    between 1 and 32. The default value is 1 and it can be changed dynamically.
    
    DESIGN
    ======
    Received acknowledgements are mantained in an array that its size is
    equal to rpl_semi_sync_master_wait_slaves - 1. Any semisync slave takes only
    one slot and only the latest ack of the slave is recorded. Each slot
    includes three items, they are server_id, binlog_name and binlog_position.
    
    If an ack should be inserted in the array and it is full, then the events
    before minimum ack in the array are replicated to enough slaves. So it will
    find the minimum ack in the array and report it to the module(which will update
    replied ack and wake up transactions) and remove the minimum ack from the array.
    
    Suppose rpl_semi_sync_master_wait_slaves = 4.
    
    coming acks          slot 1          slot 2           slot 3
    ===========          ==========      ==========       ==========
    1:log1:120           1:log1:120
    2:log1:120           1:log1:120      2:log1:120
    1:log1:150           1:log1:150      2:log1:120
    3:log1:120           1:log1:150      2:log1:120       3:log1:120
    
    4:log1:150           It is full. The minimum ack is log1:120. It is reported
                         and removed from the array. and the coming ack is added
                         into the array if it is greater than minimum ack.
                         Now the array looks like:
    
    coming acks          slot 1          slot 2           slot 3
    ===========          ==========      ==========       ==========
                         1:log1:150      4:log1:150
Loading