From 9bcdf92ff3e0935ffa7c729a86326707da4ae514 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Mon, 23 Nov 2026 21:07:25 -0500 Subject: [PATCH] docs(grpc-data): remote history for runtime consumers; plan 4.1 probe-vs-RPC negotiation decision --- docs/DataConnections.md | 49 +++++++++++++++++-- ...pc-data-connections-history-alarms-plan.md | 9 +++- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/docs/DataConnections.md b/docs/DataConnections.md index aa10711cb..c18a95729 100644 --- a/docs/DataConnections.md +++ b/docs/DataConnections.md @@ -139,13 +139,54 @@ snapshot when a row carries a bit it does not know, taking down every connection - A drop is counted once per row per accepted artifact change. A → B → A counts again, and a restart resets the count. - The dropped bits also show in the node's fleet diagnostics. -- Authoring still rejects the bits until the release that implements them. -- The optional per-call header `x-otopcua-data-features` is reserved. X0 parses it but supports no - feature, and an X0 consumer never sends it, so the wire behaviour is unchanged v1. +- Authoring rejects a bit until the release that implements it. H2 implements `HistoryRead`; the + alarm bits stay rejected until A2. +- The optional per-call header `x-otopcua-data-features` negotiates features. X0 parsed it and + supported none; H2 supports `history` (see "Remote history" above). A call without it gets + unchanged v1 behaviour. + +## Remote history (runtime consumers) + +Since H2 a consumer can read the origin's history (HistoryRead Raw, Processed, AtTime) over a data connection. The origin +serves it from its own historian backend (`ServerHistorian:Backend`) through the same pipeline its OPC UA clients use, so +statuses (info bits included), timestamps and paging come back verbatim. H2 serves **runtime consumers** that hold the +connection directly (`IDataHistoryService` on the deployed connection, or `LocalDataConnection` in-process). + +**Grants (all default off).** The `HistoryRead` operation (bit 32) must be on the consumer's `DataConnection`, on the +origin's `DataExport` for the service principal, and — for a later projected read — on the `RemoteNamespaceMapping`. +The origin also checks its own node ACL `HistoryRead` on the exported node on every call, whatever +`Security:Acl:Enabled` says. A node that is not historized, not exported, denied or unknown answers the same +`BadHistoryOperationUnsupported`, so a peer cannot tell them apart. Run X0 on every node of both clusters before ticking +the bit (see "Mixed versions" below); the AdminUI editor shows a reminder. + +**Negotiation.** The capabilities probe always asks for `history`; an origin advertises it only when a historian backend +is configured. Other calls carry the header only toward an endpoint that advertised it. An origin without a historian, a +pre-H2 origin, or a call without the header answers unsupported — the v1 responses are unchanged. + +**Limits.** + +| Setting | Default | Effect | +|---|---|---| +| `DataConnection.HistoryTimeoutMilliseconds` | 30000 | Each call's deadline is the smaller of the caller's remaining budget and this; expiry ⇒ `BadTimeout` | +| `DataExport.MaxConcurrentHistoryReads` | 4 | Concurrent history requests per principal; past it ⇒ `BadTooManyOperations` | +| `DataExport.MaxHistoryValuesPerPage` | 10000 | Per-node page ceiling; an uncapped Raw read pages at it and returns a continuation | +| `DataExport.MaxHistoryResponseBytes` | 4 MiB | Larger answers travel in bounded chunks the consumer reassembles | +| `RemoteNamespaceMapping.MaxHistoryAssemblyBytesPerRequest` | 16 MiB | Used by projected reads (H3); a direct consumer's budget is its request `MaxBytes` | + +**Continuations.** Origin continuations are single-use, idle-expire after 60 s and are bound to the principal, the HTTP/2 +connection, the serving incarnation and role, the view and the request details. A resumed read goes only to the endpoint +that issued its token: an origin restart, a failover or a lost page answers `BadContinuationPointInvalid` (start a fresh +read; a fresh read may move endpoint). Release unused continuations with `ReleaseAsync`. + +**Consistency.** History follows the connection's consistency. `ReadyReplica` is allowed; the newest seconds can lag on a +secondary while its continuous-historization outbox drains. + +**Not supported yet.** OPC UA clients reading history on projected nodes of the consumer (H3); HistoryReadEvents and +modified-value reads (deferred); **HistoryUpdate is never forwarded**. ## Feature boundary -Remote history, alarm/event forwarding and relay operations are future work. Authorized imported +Alarm/event forwarding and relay operations are future work; remote history is above. Authorized imported current values can feed local derived engines, including calculations, scripts, historization and alarm evaluation. Such local processing does not add a remote history/alarm API or permit re-export of an imported branch. diff --git a/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md b/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md index 981550ae8..ae7ccc6ba 100644 --- a/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md +++ b/docs/plans/2026-11-23-grpc-data-connections-history-alarms-plan.md @@ -269,8 +269,13 @@ refactor must keep it there. discovered only through the root-scoped item), and alarm-bearing raw tags stay exactly as v1 exports them; - Subscribe never emits a condition arm; - new RPCs answer `Unimplemented`-equivalent `FailedPrecondition("feature not negotiated")`. -- The consumer sends the header only when the selected endpoint advertised the feature. After a failover it re-derives the - header from the new endpoint's capabilities. +- **Probe vs. every other RPC (coordinator decision, 2026-11-23, H2).** The `GetCapabilities` probe ALWAYS carries the + features the consumer itself supports (H2: `history`); the server advertises a feature's capabilities field and its + operation bits only when the probe requested it AND the origin can serve it, so a header-less probe stays v1-identical. + Every other RPC carries the negotiated set = the consumer's features ∩ what that endpoint advertised, re-derived per + selected endpoint (so after a failover from the new endpoint's capabilities). The server's effective set = header ∩ + server-supported ∩ origin-servable; header-less ⇒ v1 shapes (no `Metadata.history`, no bit 32 in `allowed_operations`), + and a new RPC ⇒ `FailedPrecondition("feature not negotiated")`. - **v1 clients fault on unknown frame arms.** `GrpcDataConnection.cs:762-767` hands any frame that is neither `values` nor `compact_values` to `DecodeControlOrAck`, which throws (`DataProtoMapper.cs:1207`). This settles the revision-1 X0 question: header gating is mandatory. Unknown `CapabilitiesResponse`/`Metadata` fields are ignored by proto3 and are safe.