Re: Excessive number of replication slots for 12->14 logical replication

From: Ajin Cherian <itsajin(at)gmail(dot)com>
To: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Hubert Lubaczewski <depesz(at)depesz(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Excessive number of replication slots for 12->14 logical replication
Date: 2022-07-25 11:43:13
Message-ID: CAFPTHDZBs98Vn9OBf=x1tAo_3bTY9wnvRrRX1KMYfMqu+Pngng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jul 25, 2022 at 7:48 PM houzj(dot)fnst(at)fujitsu(dot)com
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Sunday, July 24, 2022 4:17 PM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
> I tried the patch and confirmed that we won't get the ERROR "could not find
> free replication state slot for replication origin with OID" again after
> applying the patch.
>
> I tested the patch by letting the apply worker wait for a bit more time after
> setting the state to SUBREL_STATE_CATCHUP. In this case(before the patch) the
> table sync worker will exit before the apply worker drop the replorigin, and
> the apply worker will try to start another worker which would cause the
> ERROR(before the patch).

Thanks for testing the patch.

>
> Few comments:
>
> 1)
> - * There is a chance that the user is concurrently performing
> - * refresh for the subscription where we remove the table
> - * state and its origin and by this time the origin might be
> - * already removed. So passing missing_ok = true.
> - */
>
> I think it would be better if we can move these comments to the new place where
> we drop the replorigin.

Fixed this.

>
> 2)
>
> - replorigin_drop_by_name(originname, true, false);
>
> /*
> * Update the state to READY only after the origin cleanup.
>
> Do we need to slightly modify the comment here as the origin drop code has been
> moved to other places. Maybe "It's safe to update the state to READY as the
> origin should have been dropped by table sync worker".
>

Fixed this.
Added an updated patch.

regards,
Ajin Cherian
Fujitsu Australia

Attachment Content-Type Size
v2-0001-fix-excessive-replicating-origin-slots-issue.patch application/octet-stream 3.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Steele 2022-07-25 12:40:12 Re: could not link file in wal restore lines
Previous Message houzj.fnst@fujitsu.com 2022-07-25 09:48:04 RE: Excessive number of replication slots for 12->14 logical replication