Skip to content
Snippets Groups Projects
  • Serge Petrenko's avatar
    ddec704e
    replication: fix race in accessing vclock by applier and tx threads · ddec704e
    Serge Petrenko authored
    When applier ack writer was moved to applier thread, it was overlooked
    that it would start sharing replicaset.vclock between two threads.
    
    This could lead to the following replication errors on master:
    
     relay//102/main:reader V> Got a corrupted row:
     relay//102/main:reader V> 00000000: 81 00 00 81 26 81 01 09 02 01
    
    Such a row has an incorrectly-encoded vclock: `81 01 09 02 01`.
    When writer fiber encoded the vclock length (`81`), there was only one
    vclock component: {1: 9}, but at the moment of iterating over the
    components, another WAL write was reported to TX thread, which bumped
    the second vclock component {1: 9, 2: 1}.
    
    Let's fix the race by delivering a copy of current replicaset vclock to
    the applier thread.
    
    Also add a perf test to the perf/ directory.
    
    Closes #7089
    Part-of tarantool/tarantool-qa#166
    
    NO_DOC=internal fix
    NO_TEST=hard to test
    ddec704e
    History
    replication: fix race in accessing vclock by applier and tx threads
    Serge Petrenko authored
    When applier ack writer was moved to applier thread, it was overlooked
    that it would start sharing replicaset.vclock between two threads.
    
    This could lead to the following replication errors on master:
    
     relay//102/main:reader V> Got a corrupted row:
     relay//102/main:reader V> 00000000: 81 00 00 81 26 81 01 09 02 01
    
    Such a row has an incorrectly-encoded vclock: `81 01 09 02 01`.
    When writer fiber encoded the vclock length (`81`), there was only one
    vclock component: {1: 9}, but at the moment of iterating over the
    components, another WAL write was reported to TX thread, which bumped
    the second vclock component {1: 9, 2: 1}.
    
    Let's fix the race by delivering a copy of current replicaset vclock to
    the applier thread.
    
    Also add a perf test to the perf/ directory.
    
    Closes #7089
    Part-of tarantool/tarantool-qa#166
    
    NO_DOC=internal fix
    NO_TEST=hard to test