|
| 1 | +# October 22, workflow definition routing |
| 2 | + |
| 3 | +- **Gap.** Native records the definition fingerprint a start's worker cohort |
| 4 | + agrees on, with `workflow_definition_fingerprint_source: worker`, as PHP |
| 5 | + does. It then offered that run's workflow tasks to any worker, so a worker |
| 6 | + with another definition could take a pinned run while the recorded one was |
| 7 | + live. |
| 8 | +- **Source.** Server 2.10.0's `WorkflowDefinitionRouting::forWorker`, |
| 9 | + which `WorkflowTaskPoller::matchesRecordedWorkflowDefinition` applies at |
| 10 | + claim, and `WorkflowReplayEligibility`. |
| 11 | + - **Decision.** For a workflow task of a worker-pinned run: |
| 12 | + - a worker advertising the recorded fingerprint for the type takes it |
| 13 | + (`matching_definition`); |
| 14 | + - without a recorded fingerprint (`recorded_definition_missing`), or |
| 15 | + without one from the worker (`worker_definition_missing`), nobody |
| 16 | + does; |
| 17 | + - a worker with another definition waits while an eligible peer |
| 18 | + advertises the recorded one (`matching_definition_preferred`); |
| 19 | + - otherwise it takes the task only if it advertises |
| 20 | + `workflow_entry_arguments_validation` (`replay_required`, else |
| 21 | + `entry_validation_unavailable`). |
| 22 | + |
| 23 | + An unpinned run goes to any worker (`not_worker_pinned`). Native |
| 24 | + refuses to start with `DW_V2_PIN_TO_RECORDED_FINGERPRINT` off, so |
| 25 | + pinning is always on. |
| 26 | + - **Eligible peers** (`eligibleWorkers`). Active registrations on the |
| 27 | + run's namespace and queue that: |
| 28 | + - match the build the task or run requires; |
| 29 | + - support the type, with workflow capacity above zero; |
| 30 | + - replay the run (`WorkflowReplayEligibility::allows`). That means a |
| 31 | + heartbeat inside the stale window and cooperative-cancellation support |
| 32 | + when the run has a request, at the protocol version the worker last |
| 33 | + reported. It also means the memo and typed search attribute |
| 34 | + capabilities its history needs. |
| 35 | + - **Protocol version.** Each registration and heartbeat records its |
| 36 | + protocol version under `_worker_protocol_version` in the worker's process |
| 37 | + metrics, after the metrics it reported. A heartbeat without metrics |
| 38 | + keeps the stored ones. Worker listings therefore show the key, as PHP |
| 39 | + 2.10.0's do; 2.5.14 had no such key. |
| 40 | +- **Reports** (`inspect` and `forQueue`). |
| 41 | + - Describe, repair and debug report `definition_routing` for the run's |
| 42 | + next due ready task: |
| 43 | + - the context (`pinning_enabled`, `worker_pinned`, |
| 44 | + `recorded_fingerprint`, type, queue and required build); |
| 45 | + - PHP's status, the counts of eligible workers by definition, up to ten |
| 46 | + example workers, `blocked` and `runnable_task`; |
| 47 | + - PHP's resolution text. |
| 48 | + - A blocked route adds debug's `workflow_definition_routing_blocked` |
| 49 | + warning and `diagnostic_status: needs_attention`. |
| 50 | + - Task queue describe samples up to ten runs with a due ready task. A |
| 51 | + blocked sample sets `repair.needs_attention`. |
| 52 | +- **Tests** (`definition_routing.rs`). |
| 53 | + - A pinned run goes to the worker with its recorded definition. Workers |
| 54 | + with another definition, or without one, wait even when they validate |
| 55 | + entry arguments. |
| 56 | + - Once the recorded definition leaves, only an entry-validating worker |
| 57 | + takes the run. |
| 58 | + - An unpinned run goes to any worker. |
| 59 | + - Registrations and heartbeats record the protocol version with the |
| 60 | + reported metrics. |
| 61 | + - Describe, debug, task queue and repair report a blocked route, then the |
| 62 | + route an entry-validating replacement unblocks. |
| 63 | + - The worker listing test now expects the protocol key. |
| 64 | + - Full SQLite suite: 398 passed. Routing, worker, poll, child, cooperative, |
| 65 | + debug, task queue, repair and describe tests: PostgreSQL 134, MySQL 134. |
0 commit comments