pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Logical replication stuck in catchup state
4+ messages / 3 participants
[nested] [flat]

* Logical replication stuck in catchup state
@ 2020-06-09 21:30  Dan shmidt <dshmidt@hotmail.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Dan shmidt @ 2020-06-09 21:30 UTC (permalink / raw)
  To: pgsql-general

Hi All,

We have a setup in which there are several master nodes replicating to a single slave/backup node. We are using Postgres 11.4.
Recently, one of the nodes seems to be stuck and stopped replicating.
I did some basic troubleshooting and couldn't find the root cause for that.

On one hand:
  - the replication slot does seem to be active according to pg_replication_slots (Sorry no screenshot)
  - on slave node it seems that last_msg_receipt_time is updating on pg_stat_subscription

On the other hand:
 - on the slave node: received_lsn keeps pointing on the same wal segment (pg_stat_subscription)
 - redo_lsn - restart_lsn shows ~20GB lag

According to logs on the master it seems that the sender hits a timeout, when trying to increase the wal_sender_timeout even to 0 (no timeout) - it doesn't have any effect. On the other hand, the  last_msg_receipt_time is updated. How is that possible?

Screenshots attached. The stuck subscription/replication slot is the one ending with "53db6". On images with more than one row - it's the second one.


Any suggestions on what may be the root cause or how to continue debugging?
Appreciate your help.

Thank you,
Dan.

Attachments:

pg_stat_replication.png (image/png, 83.6K) download view image
redolsn.png (image/png, 51.9K) download view image
pg_stat_subscription.png (image/png, 136.7K) download view image
pg_subscription.png (image/png, 173.9K) download view image
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Logical replication stuck in catchup state
@ 2020-06-09 21:45  Michael Lewis <mlewis@entrata.com>
  parent: Dan shmidt <dshmidt@hotmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Michael Lewis @ 2020-06-09 21:45 UTC (permalink / raw)
  To: Dan shmidt <dshmidt@hotmail.com>; +Cc: pgsql-general

I don't know if it would be relevant to this problem, but you are missing
almost 1 full year of bug fixes. 11.4 was released on 20 June last year.
Upgrading minor versions asap is recommended.

I do see this in the release notes from 11.8 last month (
https://www.postgresql.org/docs/release/11.8/)-

Ensure that a replication slot's io_in_progress_lock is released in failure
code paths (Pavan Deolasee)
--This could result in a walsender later becoming stuck waiting for the
lock.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Logical replication stuck in catchup state
@ 2020-06-09 22:21  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: Dan shmidt <dshmidt@hotmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Peter Eisentraut @ 2020-06-09 22:21 UTC (permalink / raw)
  To: Dan shmidt <dshmidt@hotmail.com>; pgsql-general

On 2020-06-09 23:30, Dan shmidt wrote:
> We have a setup in which there are several master nodes replicating to a 
> single slave/backup node. We are using Postgres 11.4.
> Recently, one of the nodes seems to be stuck and stopped replicating.
> I did some basic troubleshooting and couldn't find the root cause for that.

Have you checked the server logs?  Maybe it has trouble applying a 
change, for example due to a unique constraint or something like that.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Logical replication stuck in catchup state
@ 2020-06-10 06:15  Dan shmidt <dshmidt@hotmail.com>
  parent: Dan shmidt <dshmidt@hotmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Dan shmidt @ 2020-06-10 06:15 UTC (permalink / raw)
  To: pgsql-general

Thank you very much for your replies.

Regarding the server logs, I didn't find anything but healthy log when the server start which says that it is going to recover from the same point in WAL which was last sent.
Regarding bugfixes, I will try to update ASAP - but wouldn't a restart of the server release the lock? Is there a way to release the lock manually?

Any other suggestion on how to recover from this state without upgrading?
Is there a way to restart the replication from scratch?


Sent from Outlook<http://aka.ms/weboutlook;

________________________________
From: Dan shmidt
Sent: Wednesday, June 10, 2020 12:30 AM
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Logical replication stuck in catchup state

Hi All,

We have a setup in which there are several master nodes replicating to a single slave/backup node. We are using Postgres 11.4.
Recently, one of the nodes seems to be stuck and stopped replicating.
I did some basic troubleshooting and couldn't find the root cause for that.

On one hand:
  - the replication slot does seem to be active according to pg_replication_slots (Sorry no screenshot)
  - on slave node it seems that last_msg_receipt_time is updating on pg_stat_subscription

On the other hand:
 - on the slave node: received_lsn keeps pointing on the same wal segment (pg_stat_subscription)
 - redo_lsn - restart_lsn shows ~20GB lag

According to logs on the master it seems that the sender hits a timeout, when trying to increase the wal_sender_timeout even to 0 (no timeout) - it doesn't have any effect. On the other hand, the  last_msg_receipt_time is updated. How is that possible?

Screenshots attached. The stuck subscription/replication slot is the one ending with "53db6". On images with more than one row - it's the second one.


Any suggestions on what may be the root cause or how to continue debugging?
Appreciate your help.

Thank you,
Dan.

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2020-06-10 06:15 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09 21:30 Logical replication stuck in catchup state Dan shmidt <dshmidt@hotmail.com>
2020-06-09 21:45 ` Michael Lewis <mlewis@entrata.com>
2020-06-09 22:21 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2020-06-10 06:15 ` Dan shmidt <dshmidt@hotmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox