Skip to content

Instantly share code, notes, and snippets.

@shalvah
Last active October 7, 2024 08:19
Show Gist options
  • Save shalvah/8d8b91d3bfe33f08a2583574b6087426 to your computer and use it in GitHub Desktop.
Save shalvah/8d8b91d3bfe33f08a2583574b6087426 to your computer and use it in GitHub Desktop.

Bucardo is unfortunately not very good at reporting its progress. This guide details the most important parts.

Note: This mostly assumes you're using Bucardo with onetimecopy=1

There are three major states of Bucardo we care about:

  1. Truncating a table on the new database
  2. Doing the initial copy from old to new database
  3. Live replication mode from old to new (aka “delta mode”)

Note that Bucardo does truncate-then-copy for each table during the initial copy (ie it will truncate one table and copy to it before moving to the next).

There are two ways to check Bucardo’s progress after starting the sync with bucardo start:

  1. bucardo status <sync_name>: This will print out some details, including a field called “Current state”. Some example values of "Current state":
  • "No records found" - This happens when the sync is just starting up
  • "DELETE xxxx" - This could mean either state 1 (truncating table xxxx) or state 2 (copying into table xxxx). Bucardo does not distinguish between the two, so if the table is large, it might show this DELETE for a long time.
  • "Good" - Copy is done! Now in delta mode (live replication)
  • “Bad” - An error was encountered.
  1. tail /var/log/bucardo/log.bucardo - This is Bucardo’s main log file, which can be quite helpful if verbose logging is on (make sure to add loglevel=verbose and verbose=1 to your /etc/bucardorc. The log file will write a message when Bucardo starts and finishes the initial copy, and when it starts and finishes copying each table.

If things are unexpectedly taking too long, you can also check what’s currently happening on the Postgres side (new or old databases). Some useful queries:

  • select query, query_start from pg_stat_activity where usename = 'your_bucardo_username';
  • select * from pg_stat_progress_copy; - check progress of the current COPY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment