cardinal

Run a sync

Start, stop and resume a sync, and what each of its seven steps does.

A sync copies everything that changed in Frappe since the last run. The first sync copies everything.

Start one

On the Sync page, press Start sync. The page shows the current step, a progress bar per table, rows per second, the time left and the log, updated live.

From a terminal:

bin/frappe-migrator sync acme            # prints the log as it runs
bin/frappe-migrator sync acme --resume   # continue the last stopped or failed run
Exit codeMeaning
0Done
1Failed
2Another run of this migration is executing
3Stopped

Only one run per migration executes at a time. The UI and the CLI take the same Postgres advisory lock.

Stop and resume

Stop finishes the current batch, then ends the run as stopped. Resume continues at the next batch. Each batch of up to 2,000 rows commits in one transaction with its state, so nothing is copied twice or skipped.

If the migrator dies or you press Ctrl-C, start it again. The run shows as stopped, and Resume (or sync --resume) continues it.

The seven steps

Inventory. Reads every source table and its row count, logs the Frappe, ERPNext, HRMS and India Compliance versions, and gives each table a class. Frappe 14 and older are refused here.

Meta. Copies Roles, Custom Fields, Property Setters, Custom DocPerms, custom DocTypes, and non-standard Reports, Print Formats, Notifications, Email Templates, Letter Heads and Client Scripts. Then runs cardinal migrate -t HOST so new columns exist.

Files. Copies every tabFile row and puts its bytes in the target bucket. Unchanged files are skipped without reading their bytes.

Rows. Copies every Mapped and Carried table in name order, in batches. New and changed rows are written, unchanged rows skipped, and rows the source deleted are deleted. Refuses to run while the site's scheduler is on.

People. Copies role grants, User Permissions, DocShares as RecShares, defaults, Single values, naming series counters, password hashes and encrypted fields.

Finish. Bumps the site's meta_version if metadata changed, runs cardinal search reindex -t HOST, and marks each app's setup wizard done when Frappe's counterpart finished its own.

Checks. Compares row counts, links, ledgers, stock, pay and GST between the two sides. See Checks.

A failed row, file or check never stops the run. It is recorded with its reason, and the run moves on to the next row or step.

Other run kinds

RunWhat it runs
SyncAll seven steps
RetryThe last six steps, over failed rows and files only
CheckThe Checks step alone (bin/frappe-migrator check NAME, or Run checks)

Counters

Each table reports <table>:read, <table>:written, <table>:skipped and <table>:failed. The run also counts conflicts, deleted, carried, meta_writes, checks, checks_failed, files_lost, files_deleted and objects_put (objects new to the bucket). bin/frappe-migrator report NAME prints them with failures by kind, conflicts and every check.

On this page