monitor health of native logical replication

From: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: monitor health of native logical replication
Date: 2022-07-27 10:52:40
Message-ID: YuEY+KJfUefgb4sN@campbell-lange.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Based on my initial testing native logical replication seems easier and faster
to setup than pglogical, and may be easier for our team to administer.

One sticking point is monitoring the health of native logical replication.

Are there some native logical replication functions or calls that can, for
example, provide info such as the function pglogical.show_subscription_status?

if (pglogical_worker_running(apply))
{
PGLogicalSyncStatus *sync;
sync = get_subscription_sync_status(sub->id, true);

if (!sync)
status = "unknown";
else if (sync->status == SYNC_STATUS_READY)
status = "replicating";
else
status = "initializing";
}
else if (!sub->enabled)
status = "disabled";
else
status = "down";

The native pg_stat_subscription view does not show, for example, if the
subscription is down.

Rory

Browse pgsql-general by date

  From Date Subject
Next Message Wiwwo Staff 2022-07-27 12:49:45 Feature request: psql --idle
Previous Message hubert depesz lubaczewski 2022-07-27 06:08:29 Re: