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

     1  @startuml
     2  skinparam BoxPadding 10
     3  
     4  box "On the gateway node"
     5    participant SQL
     6    participant RootTxn
     7  end box
     8  box "On another node"
     9    participant dSQLServer
    10    participant LeafTxn
    11  end box
    12  participant cluster
    13  
    14  create RootTxn
    15  SQL -> RootTxn : client.NewTxn()
    16  ...
    17  note left of SQL
    18     forking RootTxn
    19     into LeafTxn meta
    20  end note
    21  SQL -> RootTxn : txn.GetLeafTxnInitialState()
    22  RootTxn --> SQL : LeafTxnInitialState
    23  SQL -> dSQLServer : SetupFlow(proc spec, initState)
    24  note over dSQLServer,LeafTxn: (dSQL proc starts exec)
    25  note left of SQL: actually instantiating LeafTxn
    26  create LeafTxn
    27  dSQLServer -> LeafTxn : client.NewLeafTxn()
    28  ...
    29  note left of SQL
    30     LeafTxn issuing reads
    31     on behalf of RootTxn
    32  end note
    33  dSQLServer -> LeafTxn : txn.Run(client.Batch)
    34  LeafTxn -> cluster : txn.sender.Send(roachpb.BatchRequest)
    35  ...
    36  cluster --> LeafTxn : BatchResponse
    37  LeafTxn --> dSQLServer : Batch modified in-place
    38  dSQLServer --> SQL : some results
    39  ...
    40  note over dSQLServer,LeafTxn: (dSQL proc finishes exec)
    41  note left of SQL
    42     updates to LeafTxn
    43     repatriated into RootTxn
    44  end note
    45  dSQLServer -> LeafTxn : GetLeafTxnFinalState()
    46  LeafTxn --> dSQLServer : LeafTxnFinalState
    47  dSQLServer --> SQL : final results + finalState
    48  SQL -> RootTxn : txn.UpdateRootFromLeafFinalState(finalState)
    49  ...
    50  SQL -> RootTxn : Commit/Rollback/CleanupOnError
    51  @enduml