Documentation menu

Version 1.8.0-community

Verification

How GoArchive confirms that archived data arrived intact before removing anything from the source.

Before GoArchive removes anything from the source, it confirms that what arrived at the destination matches what was read. If the check does not pass, nothing is removed.

Where it happens

Verification sits between the copy and the delete, inside every batch:

select β†’ discover β†’ copy β†’ VERIFY β†’ delete

The delete only runs if the verification succeeds. This ordering is what makes the archive workflow safe to run against production data.

Two methods

verification:
  method: sha256    # or: count

Row count

Counts the rows written to the destination and compares against the rows read from the source. Fast, and confirms that every row arrived.

SHA256

Computes a checksum over the content of the copied rows on both sides and compares them. Slower than counting, and confirms not only that the rows arrived but that their contents are identical.

Choosing a method

Row countSHA256
SpeedFasterSlower
Confirms rows arrivedYesYes
Confirms contents matchNoYes
Recommended for resuming an interrupted jobYes

sha256 is the better default. It is the stronger guarantee, and it makes an interrupted job straightforward to resume, because a batch that is replayed can be confirmed against what is already at the destination.

Choose count when throughput matters more than content-level assurance and the data is simple enough that arrival implies correctness.

Per-job methods

Different jobs can verify differently:

verification:
  method: count

jobs:
  archive_old_orders:
    root_table: orders
    primary_key: id
    where: "created_at < DATE_SUB(NOW(), INTERVAL 2 YEAR)"
    verification:
      method: sha256

Here the site default is count, but the orders job uses sha256.

Skipping verification

Verification can be turned off, either in configuration or for a single run:

verification:
  skip_verification: true
goarchive archive -c archiver.yaml --job archive_old_orders --skip-verify

Without verification, the delete step proceeds on the assumption that the copy succeeded. Keep verification on for any workflow that removes data.

Checks before the run

Verification confirms the data. A separate set of checks confirms the environment, and they run before any data moves: that both sides have the expected tables, that their structures are compatible, that the account holds the privileges the run needs, and that the declared relationships match the database.

Run them at any time:

goarchive validate -c archiver.yaml

These same checks run automatically at the start of archive, copy-only, and purge.