Dispatch a single physical task and wait for the response. In cluster mode, write operations are proposed to Raft first and only executed on the Data Plane after quorum commit. Reads bypass Raft. `user_id` is forwarded to the `Request` for DML audit attribution. Pass `None` for system-generated tasks (triggers, maintenance, etc.).
(
&self,
task: PhysicalTask,
user_id: Option<Arc<str>>,
)
| 21 | /// `user_id` is forwarded to the `Request` for DML audit attribution. |
| 22 | /// Pass `None` for system-generated tasks (triggers, maintenance, etc.). |
| 23 | pub(super) async fn dispatch_task( |
| 24 | &self, |
| 25 | task: PhysicalTask, |
| 26 | user_id: Option<Arc<str>>, |
| 27 | ) -> crate::Result<Response> { |
| 28 | let tenant_id = task.tenant_id; |
| 29 | let result = self.dispatch_task_inner(task, user_id).await; |
| 30 | // Advance per-tenant observed write-HLC high-water on any |
| 31 | // successful dispatch (local, raft-replicated, or broadcast). |
| 32 | // Used by RESTORE's staleness gate. Backup captures envelope |
| 33 | // watermark AFTER its own fan-out, so envelope.wm dominates |
| 34 | // tenant_wm on a fresh backup. |
| 35 | if let Ok(ref resp) = result |
| 36 | && resp.status == crate::bridge::envelope::Status::Ok |
| 37 | { |
| 38 | self.state.advance_tenant_write_hlc(tenant_id.as_u64()); |
| 39 | } |
| 40 | result |
| 41 | } |
| 42 | |
| 43 | async fn dispatch_task_inner( |
| 44 | &self, |
no test coverage detected