Skip to content

SiphonLogicalReplicationSlotInactive

This alert fires when no walsender has read a Siphon logical replication slot on a GitLab.com Patroni primary for 15 minutes: the slot’s producer is not replicating at all.

A running producer holds its slot, including in failover (emergency) mode, and a restart or deploy reconnects within seconds. Fifteen minutes without a reader usually means the producer is down, crash-looping, scaled to zero, or failing before it starts replicating, for example while it sets up NATS or connects to PostgreSQL.

The exception is the drain after a NATS outage. When NATS is back, the producer leaves failover mode, replays what it buffered in the failover store to NATS, and only then reconnects to the slot. A drain that runs longer than 15 minutes fires this alert on a healthy producer. The slot really is unread then, so WAL builds up on the primary until the drain finishes. See Draining after a NATS outage.

It fires well before SiphonLogicalReplicationSlotLagHigh, which waits for 100 GiB of unconfirmed WAL. In siphon#383 that took about 35 minutes. It doesn’t fire for a producer that holds its slot without advancing it; the lag alert covers that.

  • pg_replication_slots_active from postgres_exporter on the Patroni hosts, in the gitlab-gprd and gitlab-gstg Mimir tenants. It is 1 while a walsender holds the slot.
  • Restricted to Patroni primaries (type=~"patroni.*" and pg_replication_is_replica == 0), and to slots matching .*siphon.* but not .*siphon_backup.*, like the lag alert.
  • for: 15m. A single read inside the window starts it over.
  • Severity: s2, and it pages through PagerDuty (pager: pagerduty), like the 100 GiB lag alert.
  • Expected frequency: rare. A planned producer stop longer than 15 minutes fires it; silence it for the duration. So does a drain longer than 15 minutes after a NATS outage.
  • It clears as soon as the producer reads the slot again.
  • Siphon Producers dashboard: siphon_operations_total flat for the affected application.

  • On the primary, active is f and active_pid is empty for the slot:

    SELECT slot_name, active, active_pid,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn)) AS lag
    FROM pg_replication_slots
    WHERE slot_type = 'logical' AND slot_name ILIKE '%siphon%';

Follow High logical replication lag / producer not running in the Siphon runbook. In short:

  1. Find the affected DB from slot_name: prd_main_siphon_slot_1 → main, prd_ci_siphon_slot_1 → ci, prd_sec_siphon_slot_1 → sec.

  2. Check the producer pods and logs on orbit-prd (or orbit-stg):

    Terminal window
    kubectl get pods -n siphon -o wide
    kubectl logs -n siphon -l app=postgres-<db>-producer --tail=200

    A producer that keeps logging siphon producer failed, restarting... is failing before replication starts; the error after it names the cause, often NATS (see the NATS runbook) or PostgreSQL connectivity. A producer logging draining failover store and failover object drained is draining; see below.

  3. Restart the producer once the cause is fixed. This is safe: it resumes from the slot.

    Terminal window
    kubectl rollout restart deployment/postgres-<db>-producer -n siphon

The producer is draining if, right after a NATS outage:

  • it logged NATS recovered; exiting failover mode and restarting siphon core, then draining failover store and failover object drained lines;
  • “Drained messages after emergency mode” on the Siphon Producers dashboard is rising, and the backlog siphon_failover_writes_total - siphon_failover_drain_published_total is falling.

Let the drain finish. A restart doesn’t speed it up: the drain picks up where it stopped. The alert clears when the producer reconnects to the slot. If the backlog stops falling or siphon_failover_drain_errors_total rises, follow NATS unavailable (producer in emergency mode) in the Siphon runbook.