Skip to content
Snippets Groups Projects
  • Serge Petrenko's avatar
    7eb4650e
    box: start counting local space requests separately · 7eb4650e
    Serge Petrenko authored
    Sign local space requests with a zero instance id. This allows to split
    local changes aside from the changes, which should be visible to the whole
    cluster, and stop sending NOPs to replicas to follow local vclock.
    
    Moreover, it fixes the following bug with local spaces and replication.
    In a situation when there are a master and a replica set up, replica may
    still write to local spaces even if it's read-only. Local space
    operations used to promote instance's lsn before this patch. Eventually,
    master would have vclock {1:x} and replica'd have vclock {1:x, 2:y},
    where y > 0, due to local space requests performed by the replica.
    If a snapshot happens on replica side, replica will delete it's .xlog
    files prior to the snapshot, since no one replicates from it and thus it
    doesn't have any registered GC consumers.
    From this point, every attempt to configure replication from replica to
    master will fail, since master will try to fetch records which account
    for the difference in master's and replica's vclocks: {1:x} vs {1:x,2:y},
    even though master will never need the rows in range {2:1} - {2:y},
    since they'll be turned to NOPs during replication.
    
    Starting from this patch, in the situation described above, replica's
    clock will be {0:y, 1:x}, and, since local space requests are now not
    replicated at all, master will be able to follow replica, turning the
    configuration to master-master.
    
    Closes #4114
    7eb4650e
    History
    box: start counting local space requests separately
    Serge Petrenko authored
    Sign local space requests with a zero instance id. This allows to split
    local changes aside from the changes, which should be visible to the whole
    cluster, and stop sending NOPs to replicas to follow local vclock.
    
    Moreover, it fixes the following bug with local spaces and replication.
    In a situation when there are a master and a replica set up, replica may
    still write to local spaces even if it's read-only. Local space
    operations used to promote instance's lsn before this patch. Eventually,
    master would have vclock {1:x} and replica'd have vclock {1:x, 2:y},
    where y > 0, due to local space requests performed by the replica.
    If a snapshot happens on replica side, replica will delete it's .xlog
    files prior to the snapshot, since no one replicates from it and thus it
    doesn't have any registered GC consumers.
    From this point, every attempt to configure replication from replica to
    master will fail, since master will try to fetch records which account
    for the difference in master's and replica's vclocks: {1:x} vs {1:x,2:y},
    even though master will never need the rows in range {2:1} - {2:y},
    since they'll be turned to NOPs during replication.
    
    Starting from this patch, in the situation described above, replica's
    clock will be {0:y, 1:x}, and, since local space requests are now not
    replicated at all, master will be able to follow replica, turning the
    configuration to master-master.
    
    Closes #4114