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

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Ajin Cherian <itsajin(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(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-08-04 12:47:07
Message-ID: CAA4eK1J0c018BP8_PVnk-6nQsGLx74V0LUpxx0JGkktXqDEYaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Aug 4, 2022 at 1:12 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>
> Thank you for working on this. I have a comment and a question:
>
> * This has to be done after updating the state
> because otherwise if
> * there is an error while doing the database
> operations we won't be
> - * able to rollback dropped slot.
> + * able to rollback dropped slot or origin tracking.
>
> I think we can actually roll back dropping the replication origin. So
> the above comment is true for only replication slots.
>

Right, this comment should be updated.

> ---
> + replorigin_session_reset();
> + replorigin_session_origin = InvalidRepOriginId;
> + replorigin_session_origin_lsn = InvalidXLogRecPtr;
> + replorigin_session_origin_timestamp = 0;
> +
> + replorigin_drop_by_name(originname, true, false);
>
> With this change, the committing the ongoing transaction will be done
> without replication origin. Is this okay? it's probably okay, but
> since tablesync worker commits other changes with replication origin
> I'm concerned a bit there might be a corner case.
>

AFAICS, we always apply the changes and commit/rollback those before
calling process_syncing_tables(). For example, see
apply_handle_commit(). So, I don't see how we can miss a corner case.
It seems to me that we shouldn't be in a transaction in
process_syncing_tables().

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Martijn van Oosterhout 2022-08-04 14:41:11 Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
Previous Message Amit Kapila 2022-08-04 12:19:27 Re: No-op updates with partitioning and logical replication started failing in version 13