Обсуждение: monitor health of native logical replication

Поиск
Список
Период
Сортировка

monitor health of native logical replication

От
Rory Campbell-Lange
Дата:
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