github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/docs/tech-notes/txn_coord_sender/mismatch.puml (about)

     1  @startuml
     2  participant SQL
     3  participant "RootTxn\n+TxnCoordSender" as RootTxn
     4  participant "LeafTxn\n+TxnCoordSender" as LeafTxn
     5  
     6  create RootTxn
     7  SQL -> RootTxn : NewTxn()
     8  RootTxn -> RootTxn : init txn object (epoch = 1)
     9  activate RootTxn
    10  SQL -> RootTxn : GetMeta()
    11  RootTxn --> SQL : leafmeta
    12  create LeafTxn
    13  SQL -> LeafTxn : NewTxn(leafmeta)
    14  LeafTxn -> LeafTxn : init txn object (epoch = 1)
    15  activate LeafTxn
    16  ...
    17  SQL -> RootTxn : Send(BatchRequest)
    18  RootTxn -> cluster : Send(BatchRequest)
    19  cluster -[#red]-> RootTxn : recoverable error!
    20  deactivate RootTxn
    21  RootTxn -> RootTxn : new txn object (epoch = 2)
    22  activate RootTxn
    23  ...
    24  SQL -> LeafTxn : Send(BatchRequest)
    25  LeafTxn -> cluster : Send(BatchRequest)
    26  cluster -[#red]-> LeafTxn : recoverable error!
    27  deactivate LeafTxn
    28  LeafTxn --> SQL : leafmeta + error
    29  SQL -> RootTxn : Augment(leafmeta)
    30  RootTxn -> RootTxn : woops? (leafmeta.epoch = 1 vs txn epoch = 2)
    31  @enduml