IMD SolutionComputing LibraryShop main store

Troubleshooting

Ignition quarantined history recovery while PostgreSQL is down

Edge computing and IIoT Published 7 min read

Short answer

Quarantined records cannot be queried: the store-and-forward engine serializes them for its own retry, and no report or script reads them. Add a working database connection as the failover datasource on each gateway now, so the cache drains and quarantine stops growing, then retry the quarantine from each gateway's Store and Forward page once PostgreSQL is back. A cache export is only a one-time snapshot.

On this page
  1. Quarantine is a queue, not a database
  2. What is at risk while you wait
  3. Add a failover datasource now
  4. Will the backlog survive the wait
  5. Retry the quarantine after PostgreSQL returns
  6. Verify the recovered history
  7. When an export is the right call
  8. Questions asked

There is no supported way to query quarantined records while PostgreSQL is down. Quarantine is a holding area the store-and-forward engine writes for its own retry logic, serialized in the engine's format, and no history provider, report or script reads it. The recovery has two moves in a fixed order. First, add a working database connection as the failover datasource on each gateway today, so the cache drains and the quarantine stops growing. Second, once PostgreSQL is back, retry the quarantine from each gateway's Store and Forward page so the records land in the original historian tables. An export of the cache is a one-time snapshot, not a historian, and comes last.

Quarantine is a queue, not a database #

Follow one record. A historized tag change is evaluated by the tag system, built into a history record by the tag history provider on the gateway that owns the tag, and handed to that gateway's store-and-forward engine. The engine holds recent records in memory, spills them to a local cache on disk, and sends batches through the database connection. A batch that keeps failing is moved to quarantine so fresh records can keep moving; the design reason is covered in why Ignition quarantines store-and-forward data.

Two consequences follow. The history provider answers queries from the database, not from the cache, so every trend and report over the outage window comes back empty even though live values read normally on screen — the same split behind why Ignition historian tags stopped recording but live data is good. And each gateway runs its own store-and-forward engine, so the edge gateway's unlogged history sits in that gateway's own cache and quarantine; the central gateway holds no copy of it. Run the recovery on both gateways, and treat the edge gateway's copy as the only one.

What is at risk while you wait #

  • Disk space. The local cache and the quarantine grow for as long as PostgreSQL is down, on each gateway separately. Record free space on both data drives now.
  • The cache record limit. Each store-and-forward engine has a configurable maximum record count for its local cache. When the cache reaches it, the engine drops new records, silently and permanently. Read the configured value on each gateway and compare it with the record count on the Store and Forward status page.
  • The delete option. The same page can delete quarantined data, and wiping a gateway's data directory during troubleshooting destroys the only copy of that history. Until the records are confirmed in a database, leave the quarantine untouched.

Add a failover datasource now #

  1. Confirm the fault is on the database side. From each gateway host, test TCP reachability to the PostgreSQL server on its configured port (5432 by default) and read the connection's status and fault message on the gateway. If that connection tests valid, the outage is not your cause, and troubleshooting Ignition store-and-forward to PostgreSQL is the better track.
  2. Stand up a temporary database that both gateways can reach. Any engine the gateways support over JDBC works; the tag historian creates its own tables on first write, so an empty database is enough.
  3. Create a database connection to the temporary database on each gateway and confirm it tests valid.
  4. Edit the original connection on each gateway and set its failover datasource to the new connection. Failover works at the connection level in Ignition 8.1: while the main connection is unavailable, every query executed on it passes through to the failover.
  5. Choose the failover mode. Standard stays on the failover until the gateway restarts or the connection is reset; Opportunistic returns to the primary automatically when the primary recovers. For a database that will come back without warning, choose Opportunistic on both gateways, so logging resumes in the original tables the moment PostgreSQL is healthy.
  6. Watch the store-and-forward status on each gateway: in Ignition 8.1, from the Gateway's Status section open Connections > Store and Forward and click the details tab next to the engine. The cache count should drain and the quarantine count should stop climbing. If quarantine keeps growing, the failover is not active on that gateway; recheck steps 3 and 4 there.

Will the backlog survive the wait #

Worked example with example inputs; your tag count and rate differ, so reuse the arithmetic, not the numbers.

Edge gateway: 150 tags, one stored record every 5 seconds per tag.

  • Records per minute: 150 x 12 = 1,800.
  • Records per hour: 1,800 x 60 = 108,000.
  • Records per day: 108,000 x 24 = 2,592,000.
  • A 3-day outage: 2,592,000 x 3 = 7,776,000 records.

Bytes per record is not a documented constant; measure it on your own gateway. After 12 hours of outage the status page shows 1,296,000 records (108,000 x 12) and the cache folder on disk measures 129.6 MB, which is 129,600,000 bytes / 1,296,000 records = 100 bytes per record. The projected 3-day cache is 7,776,000 x 100 bytes = 777,600,000 bytes, about 0.78 GB. With 2 GB free on that data drive the wait fits; with 500 MB free it does not, and space has to be freed today.

The cache record limit decides the rest. If the configured limit on that engine is 5,000,000 records, the projection overruns it by 7,776,000 - 5,000,000 = 2,776,000 records, and the engine drops the newest ones. Raise the limit above the projection, 10,000,000 in this example, on each gateway before the backlog gets there.

With the failover active, the cache drains instead of growing and both numbers stop mattering. That is why the failover goes first.

Retry the quarantine after PostgreSQL returns #

  1. Confirm the original connection shows valid on each gateway. With Opportunistic mode it returns on its own; with Standard mode, switch it back to the primary yourself.
  2. On each gateway, open Connections > Store and Forward from the Status section, click the details tab, and retry the quarantined sets one engine at a time. Start with the edge gateway if its reports have priority. Many small sets are tedious to retry by hand; a scripted store-and-forward quarantine retry repeats the action for you.
  3. Watch the quarantine count fall to zero and the cache count follow it. Records that fail again return to quarantine with the error attached; read it before retrying that set.
  4. Merge the outage-window history the temporary database collected into the primary historian, or every report that queries only the primary shows a gap for the outage. With PostgreSQL on both sides, a database-level copy of the history tables is the cleanest route. Verify the merge, then remove the failover setting and retire the temporary connection.

Verify the recovered history #

  • Pick a known tag and query it across the full outage window: rows must run from the first minute of the outage to the retry, with values and timestamps intact.
  • Quarantine count at zero and cache count at or near zero, on both gateways.
  • If you also loaded an export anywhere, check that window for duplicate timestamps before the reports use it.
  • A zero quarantine count proves the engine let go of the records; only a query that returns the rows proves they are stored — the same standard as when store-and-forward data counts as stored in the historian.

When an export is the right call #

The Store and Forward page offers retry, delete, or export for each quarantined set. The export is the engine's own serialized data for later use through Ignition, not SQL or CSV, so making it queryable takes a parsing script or utility working on a copy of the files, and the rows then have to be loaded into a scratch database that production reports never read. It captures only the moment of the export — quarantine keeps growing afterward — so it is a one-time snapshot, not continuous access. Use it only when a report must cover the edge gateway's history before PostgreSQL returns, and plan to discard the scratch data once the retry lands the same records in the real tables.

Questions asked

Can I retry the quarantine while PostgreSQL is still down, once the failover is active?

Yes, and that is the one good reason to break the wait-first order. Retry resends each quarantined set through the same database connection, and while the main connection is down every query on it follows the failover, so the records land in the temporary database and become queryable there the same day. Do it only if a report needs that chunk before the primary returns, because the retried history then has to be merged into the primary with the rest of the outage window instead of landing there directly.

What does it mean when records keep returning to quarantine after a retry?

The database is rejecting the writes, and the error attached to the set says why. A constraint violation or a missing table usually means the restored PostgreSQL does not match the schema the historian expects, for example after a restore from an older backup. Fix the cause on the database side, then retry the same set again. Retrying without changing anything only cycles the same records, and the quarantine count never reaches zero.

Should I point the tag historian at the temporary connection instead of setting a failover datasource?

You can, and it catches new records the same way, but it means editing the history provider on each gateway and remembering to change it back later. The failover datasource leaves the historian untouched: the original connection keeps its name, queries through it are redirected automatically, and removing the failover setting later restores the original path in one edit. For an outage measured in days, that is the smaller change with the same protection.

Does the failover datasource affect anything besides tag history?

Yes. The redirect is connection-wide, so transaction groups, named queries and scripts that write through the original connection also land in the temporary database during the outage. Include their tables in the merge plan, or move those writers to their own connection so only the historian uses the failed-over one. Either way, note what wrote where while the failover was active, because the merge has to reproduce it in the primary.

Keep reading

  • Selection guide

    Choosing an edge data path for periodic records

    For independent periodic samples, Tag Historian with Edge Sync Services is the reliable path and buffers 35 days locally. For one atomic row per collection cycle, use MQTT Transmission records landing in MQTT Recorder. For true transaction groups, license a standard gateway for that node.

    Edge computing and IIoT

  • Troubleshooting

    Why Ignition historian tags stopped recording but live data is good

    Correct live values, an executing historical scan class and a valid database connection prove acquisition only. Set Timestamp Source to System so Max Time Between Records of 10 seconds forces samples against the gateway clock, then read the Store and Forward queue direction and the database's own insert errors. Zero stored rows against a timed minimum count means the write path, not the tag, has failed.

    Edge computing and IIoT

  • How-to

    MQTT store and forward backfill after a connection outage

    Yes. Tag data collected on the edge during the outage fills the server gap after reconnection, but only when Store and Forward is enabled in MQTT Transmission on the edge and history is enabled on the receiving MQTT Engine tags. Matching historian database names on both systems does nothing.

    Edge computing and IIoT