pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Drouvot, Bertrand <bertranddrouvot.pg@gmail.com>
To: Bruce Momjian <bruce@momjian.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: PG 16 draft release notes ready
Date: Sat, 20 May 2023 10:37:58 +0200
Message-ID: <384324d0-c605-be69-650a-ccf0a88dcee8@gmail.com> (raw)
In-Reply-To: <ZGdrko+a/QpwQdSg@momjian.us>
References: <ZGaPa7M3gc2THeDJ@momjian.us>
	<890b2035-7bd0-c243-de7c-84809b35ffb0@gmail.com>
	<ZGdrko+a/QpwQdSg@momjian.us>

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





view thread (141+ messages)  latest in thread

Message-ID: <384324d0-c605-be69-650a-ccf0a88dcee8@gmail.com>
Permalink:  ../384324d0-c605-be69-650a-ccf0a88dcee8@gmail.com/
Also on:    postgresql.org/message-id/384324d0-c605-be69-650a-ccf0a88dcee8@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: bertranddrouvot.pg@gmail.com, bruce@momjian.us
  Subject: Re: PG 16 draft release notes ready
  In-Reply-To: <384324d0-c605-be69-650a-ccf0a88dcee8@gmail.com>
  References: <ZGaPa7M3gc2THeDJ@momjian.us> <890b2035-7bd0-c243-de7c-84809b35ffb0@gmail.com> <ZGdrko+a/QpwQdSg@momjian.us> <384324d0-c605-be69-650a-ccf0a88dcee8@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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