Upgrade a replication pipeline

Copy Markdown View Source

Use this guide when upgrading Replicant, its PostgreSQL source, or the output plugin. For a source or plugin cutover, preserve the checkpoint on the same source.

Correct start options

Compare the options you pass to Replicant.start_link/1 with its options table. Remove unknown keys and correct misspellings such as orign: to origin:. Keep one entry per key, including in Replicant-owned nested settings. If you combine options from multiple lists, use Keyword.merge/2 to choose the precedence explicitly.

Set go_forward_only: to true or false. Omit it to use the false default. Adapters must pass a boolean when forwarding go_forward_only: to Replicant. Pass Postgrex options as keyword lists for both source and checkpoint connections. Omit checkpoint_store[:table] or checkpoint_store[:progress_table] to use the default table name. When supplied, each must be a valid PostgreSQL identifier.

Migrate backpressure alerts

  • Replace :sink_too_slow alerts with [:replicant, :connection, :stalled]. The event reports outstanding assembler work with no completed frames for five seconds, whether intake is paused or still receiving.
  • Treat [:replicant, :connection, :disconnected] as a connection signal with empty measurements and metadata. For stalled work, use the duration, change_count, and byte_size from the :stalled event.
  • Size max_inflight_lag for queued payload and retained transaction data. Monitor PostgreSQL slot retention using pg_replication_slots.restart_lsn and source disk usage. Set max_slot_wal_keep_size to the source's retention budget. Exceeding that limit can invalidate a lagging slot at a checkpoint.
  • Use the recovery guide for a slot invalidation or retained payload exhaustion.

Change the PostgreSQL source version or output plugin

  1. Check compatibility before upgrading the server or starting the pipeline against it.
  2. Replace decoder: :wal2json and its tables:, allow_keyless_tables: and schema_check_interval: options with a pgoutput configuration. Create a publication and verify its table and operation coverage. A pglogical pipeline keeps replication_sets:.
  3. Quiesce writes to the source, drain the old pipeline through its last committed change, and persist its checkpoint. Create a new pgoutput slot while writes are quiesced. A logical slot keeps its original output plugin.
  4. Confirm the new slot's consistent point covers the cutover and reconcile it with the sink's checkpoint before resuming writes and consumption. Keep checkpoint positions bound to their source and leave unverified WAL intervals unacknowledged.

For a state mirror, a fresh snapshot can rebuild current state. For an append log, preserve the prior history through the handoff or reconcile it using independently retained records before advancing the checkpoint. See ADR-0010 for the support decision and snapshot coverage for backfill behavior.

Change the replication origin mode

  1. Stop the pipeline and record the sink's durable checkpoint and the slot's confirmed flush LSN. Compare the old and new modes.
  2. Reconcile the sink against the intended coverage before resuming, or reseed a state mirror if reconciliation requires a fresh snapshot. Widening from :none to :any cannot recover changes the source already filtered and the pipeline acknowledged. Restore missing append-log history from retained records.
  3. Restart with the new mode after verifying that the sink and source agree at the cutover. Check snapshot coverage before using a reseed for local-only delivery.