Gateway historian: strict lowered ceiling refuses ordinary pages; deep event reads slow (follow-ups from #689–#691 gate) #694
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Current status (2026-10-13): items 1 and 2 are implemented and merged in PR #699 (
618d98e8), with strict-ceiling paging and bounded deep event probes covered by regressions. Item 3 remains open: live native TimeAverage/Total forward/reverse, all-NULL and sub-ms clipped intervals require historiangw #27 verification after #29 retrieval recovery. Actual deployed OPC UA validation is tracked separately in #700. The event identity/received-time observation remains under historiangw #28 and SQL projection fault #39; sender identity fix #705 is merged, but native persistence is unverified.Original findings:
Found by the #689–#691 live AVEVA gate (2026-10-13, master
942ca7bc). Low priority.MaxValuesCeiling=1000,AllowStreamingBeyondCeiling=false, a capped raw read with N=5000 returnsBadTooManyOperations. It could serve up to the learned ceiling and return a continuation point instead (a page smaller than N is legal in Part 11).Runtime.dbo.Eventsindex use.Gateway-side observation for historiangw (not OtOpcUa): 21 of 23
OtOpcUaLiveValidationevents read back with an all-zero EventId, andreceivedTimeis ~4 h beforeeventTime.Items 1 and 2 fixed on master
66a2b0c3(commits3c3513ea,de8bc7a1). Live AVEVA gate PASS (2026-10-13). Item 3 stays open, blocked on historiangw#27 (still open), so this issue stays open for it.1. Strict lowered ceiling.
IHistorianDataSource.MaxRawValuesPerRead(Gateway: learned ceiling − 16; 0 elsewhere). The node manager'sRawPageLimitsizes every raw page so page + boundary ties + lookahead stay within it.N = 0reads, now get a ceiling-sized page plus a continuation point instead ofBadTooManyOperations.AllowStreamingBeyondCeiling=false): N=5000 and N=0, forward / reverse / end-only / from 1970, page at 983/982 rows with continuation points. Every result matched the streaming gateway's exactly. One learning refusal, then no raw request above 1,000.2. Deep event reads. New opt-in, lossy
ServerHistorian:EventReadHorizon(default00:00:00= off). When set, events older than now − horizon are never read; a window wholly older answersGoodNoDatawithout contacting the gateway. Live: a 30-day horizon cut an end-only events read from 17.6 s to 1.57 s. No per-source earliest-event cache, by design: late store-and-forward drains would make it stale. Gateway-sideRuntime.dbo.Eventsindex use is for historiangw.Found and fixed along the way (review fuzz):
PreWindowRowsand retries once.MaxTieClusterOverfetch), so a 200-row margin is served.Tests: 30
GatewayCeilingPagingTestson a real SDK server plus the real Gateway source. Reviewer fuzz: ~24k drains (cold and warm, random ceilings, ceiling changes, ReturnBounds), 0 wrong results, 0 non-terminating.Follow-ups: #695 (warm reads refuse a cluster that fits under the ceiling), #696 (AtTime future-time cost; strict-ceiling stopped-tag cost), #697 (backend outage answered BadHistoryOperationUnsupported), #698 (value types across backends).
Rechecked remaining item 3: historiangw#27 is still open. The native TimeAverage/Total live rerun remains blocked on that upstream interval fix. Items 1/2 remain handled by base
66a2b0c3. Leaving this issue open; no upstream code changed.Pushed commit
97668d26; PR: #699.Full solution verified: 14,581 passed, 609 skipped, 0 failed across 62 suites (
dotnet test ZB.MOM.WW.OtOpcUa.slnx --verbosity quiet, exit 0). Independent final review found no important defects. New fixes have not been deployed or live-tested end to end through OPC UA.PR #699 merged as 618d98e8; #653 and #695–#698 are closed. The native TimeAverage/Total live rerun remains open here, blocked on historiangw#27. Broader deployed endpoint verification is tracked by #700, with the existing-tag Raw control outage tracked by historiangw#29.
Unblocked 2026-11-12: item 3 waited on historiangw#27, which closed 2026-11-10 (fix on main + live bucket check passed for TimeWeightedAverage and Integral). Removed
blocked; the native TimeAverage/Total live rerun is starting.Item 3 is done and verified live. Closing (items 1 and 2 were closed in PR #699).
Commits on
master:53978ca6(code + tests; tested as4c8e977ebefore the rebase onto09b373e4, which changes no historian code) and639f511c(evidence: aveva-gate.md).Code
ServerHistorian:Gateway:EnableNativeTimeWeightednow defaults to true. TimeAverage and Total are served and advertised again (12 aggregates).falseis the kill switch for a gateway older than9f711c1.NativeAggregatePlan. The gateway sends the interval asmax(1, round(ms)), and AVEVA clips its last interval at the request end.BadTooManyOperations).GatewayNativeWholeMillisecondGridTests, using a fake that rounds like the gateway. The default-flip tests were updated. All were mutation-checked; removing either fix or reverting the default fails them.Live (read-only)
Setup: OtOpcUa server in process, wired to the production Gateway backend, read over a real SDK 2.0.1 client session. HistorianGateway
maindffb5e2(server code = DEVea9f21c+ the Telemetry bump), run locally in Docker with auth disabled and live writes off. Historian: AVEVA 2023 R2 on wonder-sql-vd03. Each bucket was checked against the backend's direct answer and against a step-held integral ofSysTimeSec's own raw rows.0x00000401.ZIPSEN.WTC1outage on 2026-11-10, 60 s intervals): the intervals with no good time areBadNoData | Calculated(0x809B0401) with a null value. The NULL-plus-some-good intervals are Uncertain0x40A40401with a value. Same in both directions.Follow-up: #897. On a discrete AVEVA tag AVEVA refuses both modes, so the node answers
BadHistoryOperationUnsupported(never a value), and the read counts as a backend failure.The event identity / received-time observation stays with historiangw#28 / #39, as noted in this issue's body.
Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi