feat(historian): #1046 a QuestDB WAL visibility give-up is a metric (counter + recent-failure gauge), not only a log line

Also records the #1008 finding in docs: the fixture's 0-row readback was the designed visibility timeout under host load, not a writer/reader defect.
This commit is contained in:
Joseph Doherty
2026-12-03 14:56:16 -05:00
parent cc7155e5e9
commit bd973f2ea7
3 changed files with 113 additions and 0 deletions
+7
View File
@@ -2380,6 +2380,13 @@ catalog/provisioner and the alarm writer (`QuestDbWalVisibility`): after the INS
reported `suspended` (Warning, stop), or `VisibilityTimeout` elapses (Warning). A timeout never changes a result code and never discards data;
the rows simply become visible shortly after. Measured: median 0 ms, p95 6 ms.
**A wait that gives up is a metric, not only a log line (#1046).** Besides the Warning, every timeout / suspended-table give-up increments the counter
`otopcua.historian.questdb.wal_visibility.failures{table, reason=timeout|suspended}` and holds the gauge
`otopcua.historian.questdb.wal_visibility.recent_failure` at 1 for the following 5 minutes (alert on it). A sustained non-zero rate means
read-your-writes is not holding — QuestDB's WAL apply is lagging (an overloaded host) or a table is suspended — so a HistoryRead or an
immediate redelivery can see fewer rows than were written; the writes themselves are committed. This is also how the shared test fixture's
"read back 0 rows" symptom (#1008, host load average ~50 on 22 cores) is diagnosed: it is the designed timeout, not a writer/reader defect.
**The live writer waits once per drain pass, not once per tag group.** The recorder writes every group of a pass through the writer's
`IHistorianPassWriter` path and then calls `FlushAsync` once — after every group has reported, before the ack, whenever any group wrote —
so the pass's rows are visible to the next pass's insert-if-absent check. With `DrainConcurrency = 8` the per-group wait used to run up to