Re: BUG #19029: Replication Slot size keeps increasing while logical subscription works fine

From: Thadeus Anand <thadeus(at)rmkv(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19029: Replication Slot size keeps increasing while logical subscription works fine
Date: 2025-08-25 05:44:03
Message-ID: CANUywMFJwPitPdq69F1E+Hb6kpW1w7g8pSG0Z+30jgK4D8p=Xg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

> Can you share an example as to what you mean by folder keeps
> increasing? Is the slot size on disk is increasing?

The size on the disk keeps increasing. Last week, it went upto 35 GB per
slot, then I had to put a 20GB limit on max_slot_wal_keep_size. After
reaching the size limit, the subscriptions went inactive. Then I dropped
the subscriptions and freed up the replication slots.

> To understand the problem you are facing, we need to see some real
> data on the size. Can you share the output of pg_replication_slots
> both before and after the folder's size increase?

I cannot share the real data right now because I have dropped the
subscriptions and publications altogether. I can create them again tonight
(I am in India) and share the details tomorrow.

> Is it possible to share a reproducer or some steps to reproduce the
problem?

What I had was a straightforward logical replication setup. We had two
publications and six subscribing servers. Please also note that this setup
was working fine with PostgreSQL 15. During May we upgraded to 17.5, and
ran into a bug which is described in the following release notes section of
17.6

-

Avoid re-distributing cache invalidation messages from other
transactions during logical replication (vignesh C) §
<https://postgr.es/c/45c357e0e>

Our previous round of minor releases included a bug fix to ensure that
replication receiver processes would respond to cross-process cache
invalidation messages, preventing them from using stale catalog data while
performing replication updates. However, the fix unintentionally made them
also redistribute those messages again, leading to an exponential increase
in the number of invalidation messages, which would often end in a memory
allocation failure. Fix by not redistributing received messages.

Due to the bug, we stopped using logical replication and started it again
after updating to 17.6. Now we are having this issue.

Thadeus Anand.

On Mon, Aug 25, 2025 at 10:55 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
wrote:

> On Mon, Aug 25, 2025 at 10:39 AM Thadeus Anand <thadeus(at)rmkv(dot)com> wrote:
> >
> > Hi,
> >
> > The number of replication slots does not increase at all. But the size
> of each folder keeps increasing simultaneously.
> >
>
> Can you share an example as to what you mean by folder keeps
> increasing? Is the slot size on disk is increasing?
>
> > When I restart a subscriber, the size of the respective slot resets,
> then immediately grows up to the size of the slots of other subscribers.
> >
>
> To understand the problem you are facing, we need to see some real
> data on the size. Can you share the output of pg_replication_slots
> both before and after the folder's size increase?
>
> > The table data is properly synchronized across the locations, and the
> status of the replication remains as 'streaming'. So, effectively, the
> logical replication works (which it wasn't in version 17.5), but the
> replication slot isn't resetting.
> >
>
> Is it possible to share a reproducer or some steps to reproduce the
> problem?
>
> --
> With Regards,
> Amit Kapila.
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2025-08-25 08:05:34 RE: BUG #19029: Replication Slot size keeps increasing while logical subscription works fine
Previous Message Amit Kapila 2025-08-25 05:24:48 Re: BUG #19029: Replication Slot size keeps increasing while logical subscription works fine