IMD SolutionComputing LibraryShop main store

Troubleshooting

Backfill late and out-of-order data into Canary collectors

Edge computing and IIoT Published 6 min read

Short answer

Canary's SQL and MQTT collectors both insert historical samples that arrive out of time order, so late data after an outage lands at its correct timestamp; only the OPC DA and OPC UA collectors refuse inserts. Confirm a backfill by opening the affected window in the historian files and looking for samples marked Added with Good quality, and set the MQTT Collector's Reordering Queue Size above its default 0 when messages arrive out of sequence.

On this page
  1. Which collectors insert late data and which refuse it
  2. Why an insert costs more than an append
  3. Why the SQL Collector shows no late data even though it can insert
  4. Verifying the backfill in the historian files
  5. Sizing the MQTT reordering queue
  6. Worked example: backfilling a 6-hour outage across 12 tags at 5-second logging
  7. Procedure to land late data and prove it
  8. Questions asked

Both collectors in question handle the case: the SQL Collector and the MQTT Collector insert historical samples whose timestamps fall behind data already in the archive, so late data from an outage lands at its correct time instead of being dropped. The only collectors that refuse inserts are the OPC DA and OPC UA collectors, and no setting changes that. You can prove an insert in the historian files, because late samples carry an <Added> Good quality marker. On the MQTT side, out-of-sequence messages are governed by the Reordering Queue Size setting, whose default of 0 means no buffering — an out-of-order message triggers a birth request instead. So when a SQL backfill goes missing, the cause sits in the data path or the query, not in a collector limitation.

Which collectors insert late data and which refuse it #

Canary's historian storage documentation (version 23) is explicit about the split: the OPC DA and OPC UA collectors are not able to insert historical records, while the SQL and MQTT collectors are. That makes the collector type the first decision, before any tuning.

Collector Inserts older timestamps? Out-of-order handling
SQL Collector Yes Rows are placed into the archive at their timestamp position
MQTT Collector Yes Inserts at timestamp position; message reordering handled by Reordering Queue Size
OPC DA Collector No Not supported; no configuration enables it
OPC UA Collector No Not supported; no configuration enables it

If late data reaches the plant through OPC DA or OPC UA, move those tags to the SQL Collector or the MQTT Collector; there is no setting on the two OPC collectors that will backfill the gap. For a one-time load, the CSV Collector handles file-based data, and the Canary web API is the route the vendor presents for building your own collector for legacy historical data.

Why an insert costs more than an append #

Canary's collector documentation (version 23) describes chronological writing as the historian's default method and its fastest. A sample whose timestamp falls inside already-stored time has to be placed within the archive, and that placement is the slower path. The decision that follows: one bounded batch covering an outage is fine and needs no special treatment, while a source that permanently delivers stale timestamps should be redesigned rather than left running in insert mode — hold the data at the source and deliver it once, or move it to a CSV or web API load. When the job has outgrown catching up an outage and become moving an existing historian's history into Canary, treat it as a migration project; moving Wonderware Historian data into Canary Historian is its own path.

Why the SQL Collector shows no late data even though it can insert #

A collector can only insert rows the query hands it. If the SQL Collector reads forward from the last timestamp it has seen, rows written later with older timestamps fall behind that position and are never requested — that is general collector behavior, so verify it against your collection mode settings. Compare the row count in the SQL table for the outage window against what the historian holds: rows in SQL but not in the historian mean the query window or the incremental logic is skipping them. Widen the window so it covers late-arriving timestamps, or trigger a one-time read over the outage range.

Verifying the backfill in the historian files #

Do this before changing any setting:

  1. Pick one affected tag and a window that matches the outage.
  2. Open the stored data for that window in the historian files.
  3. Look for <Added> with Good quality on the late samples.

Reading the result:

  • <Added> Good samples are present: the insert worked, and any missing view of them is a client query range or aggregation problem.
  • The gap remains with no <Added> samples: the rows never reached the collector, or the source query never returned them — go back to the SQL path checks above.

Sizing the MQTT reordering queue #

The MQTT Collector expects messages to arrive in sequence, and at the default it does not buffer: an out-of-order message makes the collector request a birth message from the publishing device so sequencing starts over. That birth and death machinery is the same behavior behind why an MQTT collector logs DBIRTH but ignores DDATA.

Reordering Queue Size changes that: values from 1 up to its maximum of 255 buffer up to that many messages until the expected sequence number arrives. Set it to the largest number of messages that can plausibly arrive ahead of a delayed one on your link. A value above the real reordering depth only holds buffer without benefit; a value below it falls back to the birth request. Frequent birth message requests in the publisher logs are the symptom of a queue set too small — or of sequencing broken upstream.

Worked example: backfilling a 6-hour outage across 12 tags at 5-second logging #

Inputs, each with its source:

  • Outage window: 6 h — the downtime-and-late-arrival case this article answers; the length is a typical plant outage chosen for the arithmetic.
  • Logging interval: 5 s per tag — a typical plant history rate.
  • Tags in the SQL Collector session: 12 — a typical session size.
  • Row count in the SQL table for the window: 51,840 — measured on the source with a count over the outage range.
  • Sample count in the historian for the window: 43,200, all carrying <Added> Good — measured in the historian view.

The rule in words: the expected sample count per tag is the outage duration divided by the logging interval; the expected total is that count times the number of tags; the two measured counts then say how much landed and what is missing.

The arithmetic:

  • Per tag: 6 h × 3,600 s/h = 21,600 s, and 21,600 s ÷ 5 s per sample = 4,320 samples.
  • Expected total: 4,320 samples per tag × 12 tags = 51,840 samples, which matches the SQL count — the source is complete.
  • Landed: 43,200 samples ÷ 4,320 samples per tag = 10 tags fully backfilled.
  • Missing: 51,840 − 43,200 = 8,640 samples, which is 8,640 ÷ 4,320 = 2 tags.

Decision: 43,200 samples carrying <Added> Good prove the insert path works, so nothing here is a collector limitation. The 2 absent tags have 4,320 rows each sitting in SQL that the historian never requested — a query-window problem. Fix the query so the outage range is covered for every tag and re-run; accept the backfill only when the historian count for the window reaches 51,840. The threshold to apply per tag: rows in SQL with zero in the historian for the window is a query problem, and rows in the historian without the <Added> marker are originally logged data, not backfill.

Procedure to land late data and prove it #

  1. Identify the collector type for each tag with late data.
  2. Move any of those tags off the OPC DA and OPC UA collectors; those inserts are not coming.
  3. For SQL, confirm the source query returns rows with older timestamps after the outage, then let the collector process them.
  4. For MQTT, raise Reordering Queue Size above the default if messages arrive out of sequence in normal operation, sized to the plausible ahead-count and within the 255 maximum.
  5. Watch the publisher logs for repeated birth message requests; frequent requests mean the queue is too small or sequencing is broken upstream.
  6. Re-open the outage window in the historian files and confirm <Added> Good quality samples fill the gap.

Questions asked

Does the MQTT reordering queue also cover a long publisher outage?

No. The queue only reorders messages already flowing on the broker link, up to its configured depth. For a real outage you need store-and-forward at the publishing side, so messages are held and republished afterward; the collector then inserts them at their original timestamps.

Is a slow backfill a sign the collector is misconfigured?

No. Chronological writing is the historian's default and fastest method, so placing samples inside already-archived time is inherently slower than live logging. A bounded catch-up batch running below live speed is expected behavior, and write speed returns to normal once the source is delivering current timestamps again.

When should the backfill go through the CSV Collector instead of the SQL Collector?

When the missed data exists as exported files rather than as rows you can query. The CSV Collector logs file data into the historian, which suits a one-time load of an archived export; keep the SQL Collector on the source table for ongoing collection.

What does the Added marker tell me during an audit?

It marks samples the historian placed behind its live write position, so it separates backfilled values from originally logged ones. Auditing a backfill means checking that the marker appears with Good quality on every late sample in the window. A gap with no Added samples means the data never reached the collector.

Keep reading

  • Comparison

    Canary historian export paths: MQTT publisher or API read

    Canary gives you two confirmed ways to move historian data out: the Publisher service, which pushes real-time values to MQTT or Kafka as Sparkplug B or JSON, and the Read API, which an external client calls to pull stored data. An outbound OPC UA server is not a confirmed option.

    Edge computing and IIoT

  • How-to

    Expose historian latest values over OPC UA or MQTT

    Yes — connect an integration gateway to the historian's classic I/O Server over SuiteLink (application name aahiosvrsvc, topic TagName) and publish the current values as OPC DA and MQTT. After a historian restart the I/O Server and the Live table return nothing until the source sends a new value, so a true last-known-from-disk read needs T-SQL or the historian SDK.

    Edge computing and IIoT

  • Explainer

    Exporting Sparkplug B out of Geo SCADA to a historian

    No modified DDK driver will push Sparkplug B out of Geo SCADA, because the driver layer is pull-only in the outbound direction. Build the publisher on the Client API Sample DataFeeder pattern, which watches about 100,000 points per instance; for millions of points, use HSI or a database-level connector.

    Edge computing and IIoT