@@ -126,6 +126,40 @@ This enables nice tracing across trino-lb and trino (as seen in the screenshot b
126126This flowchart represents a Trino client submitting a query.
127127It might be send to a Trino clusters or queued if all clusters are full.
128128
129+ ** General flow**
130+
131+ ``` mermaid
132+ sequenceDiagram
133+ actor client as Trino client
134+ participant lb as trino-lb
135+ participant trino as Trino
136+
137+ client ->>+ lb: Submit query using <br/> POST /v1/statement
138+ lb ->> lb: Determine if query should be queued<br/>or which Trino cluster it should be routed to.<br/>See below diagram for details
139+ lb ->>- client: # Don't strip space
140+
141+ loop While queued
142+ client ->>+ lb: Poll
143+ lb ->>- client: # Don't strip space
144+ end
145+
146+ alt Proxy mode: Proxy all calls
147+ loop While query running
148+ client ->>+ lb: Poll
149+ lb -->+ trino: # Don't strip space
150+ trino ->>- lb: # Don't strip space
151+ lb ->>- client: # Don<>'t strip space
152+ end
153+ else Proxy mode: Proxy first call
154+ loop While query running
155+ client ->>+ trino: Poll
156+ trino ->>- client: # Don't strip space
157+ end
158+ end
159+ ```
160+
161+ ** Detailed initial ` POST /v1/statement ` **
162+
129163``` mermaid
130164sequenceDiagram
131165 actor client as Trino client
@@ -149,7 +183,7 @@ sequenceDiagram
149183
150184 lb ->> lb: Determine cluster with the fewest running queries
151185
152- alt All active clusters full
186+ alt All active clusters full or all clusters unhealthy
153187 lb ->>+ persistence: Store queued query
154188 persistence ->>- lb: # Don't strip space
155189
0 commit comments