Skip to content

table-repair

Performs repairs on tables of divergent nodes based on the diff report generated by table-diff.

Syntax

./ace table-repair <cluster_name> <schema.table_name> --diff-file=<diff_file> [--source-of-truth=<node>] [options]
  • cluster_name: Name of the cluster. Optional. Overrides default_cluster in ace.yaml if specified.
  • schema.table_name: Schema‑qualified table name to repair.
  • --diff-file: Path to the diff JSON file.
  • --source-of-truth (-s): Authoritative node for repairs. Required unless you run in bidirectional insert-only mode.

Options

Option Alias Description Default
--diff-file <path> -f Path to the diff file (required)
--dbname <name> -d Database name override
--nodes <list> -n Nodes to include when resolving cluster metadata all
--source-of-truth <node> -s Authoritative node for repairs (required unless --bidirectional)
--dry-run Emit a dry-run plan instead of executing changes false
--generate-report Write a JSON repair report to reports/<YYYY-MM-DD>/repair_report_<HHMMSS.mmm>.json false
--insert-only Only insert missing rows; skip updates/deletes false
--upsert-only Insert or update rows; skip deletes false
--bidirectional Perform insert-only repairs in both directions false
--fire-triggers Execute triggers (otherwise runs with session_replication_role='replica') false
--quiet Suppress non-essential logging false
--debug -v Enable verbose logging false

Example

./ace table-repair acctg public.customers_large \
  --diff-file=public_customers_large_diffs-20250718134542.json \
  --source-of-truth=n1 \
  --generate-report

Diff reports share the same prefix generated by table-diff (for example public_customers_large_diffs-20250718134542.json). When you request a dry run or report, ACE also writes JSON summaries under reports/<YYYY-MM-DD>/repair_report_<HHMMSS.mmm>.json (or dry_run_report_<...>.json).

Sample Output

2025/07/22 12:05:24 INFO Starting table repair for public.customers_large on cluster acctg
2025/07/22 12:05:24 INFO Processing repairs for divergent node: n2
2025/07/22 12:05:24 INFO Executed 99 upsert operations on n2
2025/07/22 12:05:24 INFO Repair of public.customers_large complete in 0.003s. Nodes n2 repaired (99 upserted).