• Julien Muchembled's avatar
    master: fix check of specified TID during tpc_begin · fa5e7812
    Julien Muchembled authored
    When a transaction with a specified TID is aborted, the master
    prevented the client from retrying to commit with the same TID
    (or with smaller TID that's greater than the last comitted TID).
    
    This was found when restarting reflink before tpc_finish:
    
    INFO      commit @ 404b02a96e62442 (Δ 4 days, 1:13:16.025181)
    INFO      commit @ 404b02ab7d06c51 (Δ 4 days, 1:13:19.535375) <- restart during this commit
    INFO      commit @ 404b02ab7d06c51 (Δ 4 days, 1:13:30.912512)
    CRITICAL  connection to primary master node closed
    ERROR     [...]
    NEOStorageError: protocol error: new TID must be greater than the last committed one
    
    And after restarting the cluster, no issue:
    
    INFO      commit @ 404b02ab7d06c51 (Δ 10 days, 14:22:10.479627)
    INFO      commit @ 404b02ac3544dec (Δ 10 days, 14:22:18.280374)
    
    The issue was an internal variable that tracks the last TID:
    - either to generate strictly increasing TIDs
    - or to check that specified TID are strictly increasing
    In the latter case, it became invalid if the transaction is aborted.
    
    This commit gets rid of this internal variable and recomputes from
    other data when needed.
    fa5e7812