Planning and Preview
Inspect table relationships, validate the environment, and preview row counts before running a job.
Three commands let you understand a job completely before running it. None of them changes data.
List the jobs
goarchive list-jobs -c archiver.yaml
Shows every job defined in the configuration file, with its root table.
See the relationships
goarchive plan -c archiver.yaml --job archive_old_orders
plan draws the relationship tree and reports the order tables will be written
in and the order they will be removed in, along with a summary of the settings in
effect.
=================
Relation Tree
=================
ββββββββββββββββββ [ Tree Summary ]
β β ----------------
β orders ββββββ1-Nβββββββ Root Table: orders
β β β β Relations: 4 tables
ββββββββββ¬ββββββββ ββββββββββΌββ1-1ββ Max Depth: 2 levels
β β β Destination DB: archive
1-N β β
βΌ βΌ βΌ [ Processing ]
ββββββββββββββββββ ββββββββββββββββ --------------
β order_items β βorder_paymentsβ Batch Size: 1000
ββββββββββββββββββ ββββββββββββββββ Batch Delete: 500
Use it to confirm the structure you declared is the structure you meant.
Check the environment
goarchive validate -c archiver.yaml
validate inspects both servers and reports what it finds: whether the tables
exist, whether their structures are compatible, whether your account holds the
privileges the run needs, whether the declared relationships match the database,
and whether anything about the schema needs attention before a run.
It covers every job in the file. Narrow it to one:
goarchive validate -c archiver.yaml --job archive_old_orders
Run it after any change to a job definition or to either schema.
Preview the work
goarchive dry-run -c archiver.yaml --job archive_old_orders
dry-run reports:
- The filter the job will apply
- How many rows each table would contribute, following the actual relationships rather than counting whole tables
- Whether the configured
batch_sizefits within the destination’s limits for each table
It writes nothing. Any work it does at the destination to measure limits is undone before it finishes.
A sensible order
goarchive plan -c archiver.yaml --job archive_old_orders # is the shape right?
goarchive validate -c archiver.yaml # is the environment ready?
goarchive dry-run -c archiver.yaml --job archive_old_orders # how much will move?
goarchive archive -c archiver.yaml --job archive_old_orders # run it
