Re: PG 16 draft release notes ready

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PG 16 draft release notes ready
Date: 2023-05-20 08:37:58
Message-ID: 384324d0-c605-be69-650a-ccf0a88dcee8@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 5/19/23 2:29 PM, Bruce Momjian wrote:
> On Fri, May 19, 2023 at 09:49:18AM +0200, Drouvot, Bertrand wrote:
>> Thanks!
>>
>> "
>> This adds the function pg_log_standby_snapshot(). TEXT?:
>> "
>>
>> My proposal:
>>
>> This adds the function pg_log_standby_snapshot() to log details of the current snapshot
>> to WAL. If the primary is idle, the slot creation on a standby can take a while.
>> This function can be used on the primary to speed up the logical slot creation on
>> the standby.
>
> Yes, I got this concept from the commit message, but I am unclear on
> what is actually happening so I can clearly explain it. Slot creation
> on the standby needs a snapshot, and that is only created when there is
> activity, or happens periodically, and this forces it to happen, or
> something? And what snapshot is this? The current session's?
>

It's the snapshot of running transactions (aka the xl_running_xacts WAL record) that is used during the
logical slot creation to determine if the logical decoding find a consistent state to start with.

On a primary this WAL record is being emitted during the logical slot creation, but on a standby
we can't write WAL records (so we are waiting for the primary to emit it).

Outside of logical slot creation, this WAL record is also emitted during checkpoint or periodically
by the bgwriter.

What about?

This adds the function pg_log_standby_snapshot() to emit the WAL record that contains the list
of running transactions.

If the primary is idle, the logical slot creation on a standby can take a while (waiting for this WAL record
to be replayed to determine if the logical decoding find a consistent state to start with).

In that case, this new function can be used on the primary to speed up the logical slot
creation on the standby.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-05-20 14:01:44 Re: New COPY options: DELIMITER NONE and QUOTE NONE
Previous Message Joel Jacobson 2023-05-20 07:16:30 Re: Should CSV parsing be stricter about mid-field quotes?