Execute a pre-planned `PhysicalPlan` against the cluster. Returns one `Vec ` payload per vShard result. For point operations the returned Vec has exactly one element.
(
&self,
ctx: &QueryContext,
plan: PhysicalPlan,
)
| 84 | /// Returns one `Vec<u8>` payload per vShard result. For point operations |
| 85 | /// the returned Vec has exactly one element. |
| 86 | pub async fn execute( |
| 87 | &self, |
| 88 | ctx: &QueryContext, |
| 89 | plan: PhysicalPlan, |
| 90 | ) -> Result<Vec<Vec<u8>>, Error> { |
| 91 | let span = info_span!( |
| 92 | "gateway.execute", |
| 93 | trace_id = %ctx.trace_id, |
| 94 | tenant_id = ctx.tenant_id.as_u64() |
| 95 | ); |
| 96 | let start = SystemTime::now(); |
| 97 | let version_set = self.collect_version_set(&plan, ctx.tenant_id.as_u64(), ctx.database_id); |
| 98 | let result = self |
| 99 | .execute_with_version_set(ctx, plan, version_set) |
| 100 | .instrument(span) |
| 101 | .await; |
| 102 | // Emit an OTLP span covering the whole gateway execute so an |
| 103 | // enabled collector correlates this with the executor spans |
| 104 | // emitted by every leaseholder we dispatched to — they all |
| 105 | // share the same `trace_id`. |
| 106 | self.shared.trace_exporter.emit( |
| 107 | "gateway.execute", |
| 108 | ctx.trace_id, |
| 109 | start, |
| 110 | SystemTime::now(), |
| 111 | ctx.tenant_id.as_u64(), |
| 112 | 0, |
| 113 | result.is_ok(), |
| 114 | ); |
| 115 | |
| 116 | // Advance per-tenant observed write-HLC high-water on any |
| 117 | // successful cluster dispatch (local or remote). Used by |
| 118 | // RESTORE staleness gate. Tracking on success of every |
| 119 | // gateway.execute is intentional: backup captures its |
| 120 | // envelope watermark AFTER its own fan-out, so a fresh |
| 121 | // backup's watermark always dominates the tenant_wm it |
| 122 | // itself advanced. |
| 123 | if result.is_ok() { |
| 124 | self.shared.advance_tenant_write_hlc(ctx.tenant_id.as_u64()); |
| 125 | } |
| 126 | |
| 127 | result |
| 128 | } |
| 129 | |
| 130 | /// SQL-text entry point: checks the plan cache first. |
| 131 | /// |