agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
Hot standbys now support exporting snapshots while creating a logical replication slot
5+ messages / 3 participants
[nested] [flat]

* Hot standbys now support exporting snapshots while creating a logical replication slot
@ 2025-05-22 11:53  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: PG Doc comments form @ 2025-05-22 11:53 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: kevinkbiju@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/logicaldecoding-explanation.html
Description:

Hi,
I'm referring to this bit at the very end of the page: Creation of a
snapshot is not always possible. In particular, it will fail when connected
to a hot standby. Applications that do not require snapshot export may
suppress it with the NOEXPORT_SNAPSHOT option.
It's not clear what the intention of this is (is it referring only to
physical replication slots?) but as it stands you can export snapshots while
creating a logical replication slot. This should have been possible starting
PG16, I've tested this on PG17.
postgres=# CREATE_REPLICATION_SLOT export LOGICAL pgoutput (SNAPSHOT
'export');
-[ RECORD 1 ]----+--------------------
slot_name        | export
consistent_point | 0/36C9F28
snapshot_name    | 00000072-0000000A-1
output_plugin    | pgoutput
postgres=# SELECT pg_is_in_recovery();
-[ RECORD 1 ]-----+--
pg_is_in_recovery | t
postgres=# SHOW hot_standby;
-[ RECORD 1 ]---
hot_standby | on
As an aside, I think NOEXPORT_SNAPSHOT is from the older syntax of
CREATE_REPLICATION_SLOT and should be swapped with SNAPSHOT 'nothing'.
Thanks,
Kevin


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Hot standbys now support exporting snapshots while creating a logical replication slot
@ 2025-05-23 01:42  Fujii Masao <masao.fujii@oss.nttdata.com>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Fujii Masao @ 2025-05-23 01:42 UTC (permalink / raw)
  To: kevinkbiju@gmail.com; pgsql-docs@lists.postgresql.org



On 2025/05/22 20:53, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/17/logicaldecoding-explanation.html
> Description:
> 
> Hi,
> I'm referring to this bit at the very end of the page: Creation of a
> snapshot is not always possible. In particular, it will fail when connected
> to a hot standby. Applications that do not require snapshot export may
> suppress it with the NOEXPORT_SNAPSHOT option.
> It's not clear what the intention of this is (is it referring only to
> physical replication slots?) but as it stands you can export snapshots while
> creating a logical replication slot. This should have been possible starting
> PG16, I've tested this on PG17.

The description "Creation of a snapshot is not always possible. In particular,
it will fail when connected to a hot standby." no longer seems accurate.
Since v10 (commit 6c2003f8a1b), exporting snapshots on a standby has been supported.

This description was accurate when the first patch [1] adding that description
was written, but I think we just overlooked updating it later.


> As an aside, I think NOEXPORT_SNAPSHOT is from the older syntax of
> CREATE_REPLICATION_SLOT and should be swapped with SNAPSHOT 'nothing'.

Yes, so how about the following change?

      <para>
-     Creation of a snapshot is not always possible.  In particular, it will
-     fail when connected to a hot standby.  Applications that do not require
-     snapshot export may suppress it with the <literal>NOEXPORT_SNAPSHOT</literal>
+     Applications that do not require
+     snapshot export may suppress it with the <literal>SNAPSHOT 'nothing'</literal>
       option.
      </para>

Regards,

[1] https://www.postgresql.org/message-id/CAMsr+YFjxv0T8Yi1Q=3tVdgViU2bm+fb_-XUbTfxHsnLDNSkzg@mail.gmail...

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Hot standbys now support exporting snapshots while creating a logical replication slot
@ 2025-05-23 10:52  Kevin K Biju <kevinkbiju@gmail.com>
  parent: Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Kevin K Biju @ 2025-05-23 10:52 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@oss.nttdata.com>; +Cc: pgsql-docs@lists.postgresql.org

Hi Fuiji,

I wasn't aware that support for exporting snapshots goes as far back as
v10. The change looks good.

Thanks,
Kevin

On Fri, May 23, 2025 at 7:12 AM Fujii Masao <masao.fujii@oss.nttdata.com>
wrote:

>
>
> On 2025/05/22 20:53, PG Doc comments form wrote:
> > The following documentation comment has been logged on the website:
> >
> > Page:
> https://www.postgresql.org/docs/17/logicaldecoding-explanation.html
> > Description:
> >
> > Hi,
> > I'm referring to this bit at the very end of the page: Creation of a
> > snapshot is not always possible. In particular, it will fail when
> connected
> > to a hot standby. Applications that do not require snapshot export may
> > suppress it with the NOEXPORT_SNAPSHOT option.
> > It's not clear what the intention of this is (is it referring only to
> > physical replication slots?) but as it stands you can export snapshots
> while
> > creating a logical replication slot. This should have been possible
> starting
> > PG16, I've tested this on PG17.
>
> The description "Creation of a snapshot is not always possible. In
> particular,
> it will fail when connected to a hot standby." no longer seems accurate.
> Since v10 (commit 6c2003f8a1b), exporting snapshots on a standby has been
> supported.
>
> This description was accurate when the first patch [1] adding that
> description
> was written, but I think we just overlooked updating it later.
>
>
> > As an aside, I think NOEXPORT_SNAPSHOT is from the older syntax of
> > CREATE_REPLICATION_SLOT and should be swapped with SNAPSHOT 'nothing'.
>
> Yes, so how about the following change?
>
>       <para>
> -     Creation of a snapshot is not always possible.  In particular, it
> will
> -     fail when connected to a hot standby.  Applications that do not
> require
> -     snapshot export may suppress it with the
> <literal>NOEXPORT_SNAPSHOT</literal>
> +     Applications that do not require
> +     snapshot export may suppress it with the <literal>SNAPSHOT
> 'nothing'</literal>
>        option.
>       </para>
>
> Regards,
>
> [1]
> https://www.postgresql.org/message-id/CAMsr+YFjxv0T8Yi1Q=3tVdgViU2bm+fb_-XUbTfxHsnLDNSkzg@mail.gmail...
>
> Regards,
>
> --
> Fujii Masao
> Advanced Computing Technology Center
> Research and Development Headquarters
> NTT DATA CORPORATION
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Hot standbys now support exporting snapshots while creating a logical replication slot
@ 2025-05-23 14:46  Fujii Masao <masao.fujii@oss.nttdata.com>
  parent: Kevin K Biju <kevinkbiju@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Fujii Masao @ 2025-05-23 14:46 UTC (permalink / raw)
  To: Kevin K Biju <kevinkbiju@gmail.com>; +Cc: pgsql-docs@lists.postgresql.org



On 2025/05/23 19:52, Kevin K Biju wrote:
> Hi Fuiji,
> 
> I wasn't aware that support for exporting snapshots goes as far back as v10. The change looks good.

Thanks for the review!

I've prepared two patches: one for v15 and later, and another for v13 and v14.
Unless there are any objections, I'll go ahead and commit and back-patch the patch
to all supported branches.

Regards,

-- 
Fujii Masao
NTT DATA Japan Corporation
From 97f85a60cef32a12a1232d3d5e161718728d872f Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 23 May 2025 10:18:04 +0900
Subject: [PATCH v1] doc: Fix documenation for snapshot export in logical
 decoding.

The documentation for exported snapshots in logical decoding previously
stated that snapshot creation may fail on a hot standby. This is no longer
accurate, as snapshot exporting on standbys has been supported since
PostgreSQL 10. This commit removes the outdated description.

Additionally, the docs referred to the NOEXPORT_SNAPSHOT option to
suppress snapshot exporting in CREATE_REPLICATION_SLOT. However,
since PostgreSQL 15, NOEXPORT_SNAPSHOT is considered legacy syntax
and retained only for backward compatibility. This commit updates
the documentation for v15 and later to use the modern equivalent:
SNAPSHOT 'nothing'. The older syntax is preserved in documentation for
v14 and earlier.

Back-patched to all supported branches.

Reported-by: Kevin K Biju <kevinkbiju@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Kevin K Biju <kevinkbiju@gmail.com>
Discussion: https://postgr.es/m/174791480466.798.17122832105389395178@wrigleys.postgresql.org
Backpatch-through: 13
---
 doc/src/sgml/logicaldecoding.sgml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index 7805dd44a18..847d7de723a 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -335,8 +335,7 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
      using the slot's contents without losing any changes.
     </para>
     <para>
-     Creation of a snapshot is not always possible.  In particular, it will
-     fail when connected to a hot standby.  Applications that do not require
+     Applications that do not require
      snapshot export may suppress it with the <literal>NOEXPORT_SNAPSHOT</literal>
      option.
     </para>
-- 
2.49.0


From ecd5e21a4362dd097a28d26d5ef0f5e9a78ab968 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 23 May 2025 10:18:04 +0900
Subject: [PATCH v1] doc: Fix documenation for snapshot export in logical
 decoding.

The documentation for exported snapshots in logical decoding previously
stated that snapshot creation may fail on a hot standby. This is no longer
accurate, as snapshot exporting on standbys has been supported since
PostgreSQL 10. This commit removes the outdated description.

Additionally, the docs referred to the NOEXPORT_SNAPSHOT option to
suppress snapshot exporting in CREATE_REPLICATION_SLOT. However,
since PostgreSQL 15, NOEXPORT_SNAPSHOT is considered legacy syntax
and retained only for backward compatibility. This commit updates
the documentation for v15 and later to use the modern equivalent:
SNAPSHOT 'nothing'. The older syntax is preserved in documentation for
v14 and earlier.

Back-patched to all supported branches.

Reported-by: Kevin K Biju <kevinkbiju@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Kevin K Biju <kevinkbiju@gmail.com>
Discussion: https://postgr.es/m/174791480466.798.17122832105389395178@wrigleys.postgresql.org
Backpatch-through: 13
---
 doc/src/sgml/logicaldecoding.sgml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index 3f2bcd45a1e..dd9e83b08ea 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -455,9 +455,8 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
      using the slot's contents without losing any changes.
     </para>
     <para>
-     Creation of a snapshot is not always possible.  In particular, it will
-     fail when connected to a hot standby.  Applications that do not require
-     snapshot export may suppress it with the <literal>NOEXPORT_SNAPSHOT</literal>
+     Applications that do not require
+     snapshot export may suppress it with the <literal>SNAPSHOT 'nothing'</literal>
      option.
     </para>
    </sect2>
-- 
2.49.0



Attachments:

  [text/plain] v1-0001-PG13_PG14-doc-Fix-documenation-for-snapshot-export-in-logic.patch (2.0K, ../../864b0ee3-35af-4b87-9070-155bcd931f95@oss.nttdata.com/2-v1-0001-PG13_PG14-doc-Fix-documenation-for-snapshot-export-in-logic.patch)
  download | inline diff:
From 97f85a60cef32a12a1232d3d5e161718728d872f Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 23 May 2025 10:18:04 +0900
Subject: [PATCH v1] doc: Fix documenation for snapshot export in logical
 decoding.

The documentation for exported snapshots in logical decoding previously
stated that snapshot creation may fail on a hot standby. This is no longer
accurate, as snapshot exporting on standbys has been supported since
PostgreSQL 10. This commit removes the outdated description.

Additionally, the docs referred to the NOEXPORT_SNAPSHOT option to
suppress snapshot exporting in CREATE_REPLICATION_SLOT. However,
since PostgreSQL 15, NOEXPORT_SNAPSHOT is considered legacy syntax
and retained only for backward compatibility. This commit updates
the documentation for v15 and later to use the modern equivalent:
SNAPSHOT 'nothing'. The older syntax is preserved in documentation for
v14 and earlier.

Back-patched to all supported branches.

Reported-by: Kevin K Biju <kevinkbiju@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Kevin K Biju <kevinkbiju@gmail.com>
Discussion: https://postgr.es/m/174791480466.798.17122832105389395178@wrigleys.postgresql.org
Backpatch-through: 13
---
 doc/src/sgml/logicaldecoding.sgml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index 7805dd44a18..847d7de723a 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -335,8 +335,7 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
      using the slot's contents without losing any changes.
     </para>
     <para>
-     Creation of a snapshot is not always possible.  In particular, it will
-     fail when connected to a hot standby.  Applications that do not require
+     Applications that do not require
      snapshot export may suppress it with the <literal>NOEXPORT_SNAPSHOT</literal>
      option.
     </para>
-- 
2.49.0



  [text/plain] v1-0001-PG15_master-doc-Fix-documenation-for-snapshot-export-in-logic.patch (2.1K, ../../864b0ee3-35af-4b87-9070-155bcd931f95@oss.nttdata.com/3-v1-0001-PG15_master-doc-Fix-documenation-for-snapshot-export-in-logic.patch)
  download | inline diff:
From ecd5e21a4362dd097a28d26d5ef0f5e9a78ab968 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 23 May 2025 10:18:04 +0900
Subject: [PATCH v1] doc: Fix documenation for snapshot export in logical
 decoding.

The documentation for exported snapshots in logical decoding previously
stated that snapshot creation may fail on a hot standby. This is no longer
accurate, as snapshot exporting on standbys has been supported since
PostgreSQL 10. This commit removes the outdated description.

Additionally, the docs referred to the NOEXPORT_SNAPSHOT option to
suppress snapshot exporting in CREATE_REPLICATION_SLOT. However,
since PostgreSQL 15, NOEXPORT_SNAPSHOT is considered legacy syntax
and retained only for backward compatibility. This commit updates
the documentation for v15 and later to use the modern equivalent:
SNAPSHOT 'nothing'. The older syntax is preserved in documentation for
v14 and earlier.

Back-patched to all supported branches.

Reported-by: Kevin K Biju <kevinkbiju@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Kevin K Biju <kevinkbiju@gmail.com>
Discussion: https://postgr.es/m/174791480466.798.17122832105389395178@wrigleys.postgresql.org
Backpatch-through: 13
---
 doc/src/sgml/logicaldecoding.sgml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml
index 3f2bcd45a1e..dd9e83b08ea 100644
--- a/doc/src/sgml/logicaldecoding.sgml
+++ b/doc/src/sgml/logicaldecoding.sgml
@@ -455,9 +455,8 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU
      using the slot's contents without losing any changes.
     </para>
     <para>
-     Creation of a snapshot is not always possible.  In particular, it will
-     fail when connected to a hot standby.  Applications that do not require
-     snapshot export may suppress it with the <literal>NOEXPORT_SNAPSHOT</literal>
+     Applications that do not require
+     snapshot export may suppress it with the <literal>SNAPSHOT 'nothing'</literal>
      option.
     </para>
    </sect2>
-- 
2.49.0



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Hot standbys now support exporting snapshots while creating a logical replication slot
@ 2025-05-26 03:56  Fujii Masao <masao.fujii@oss.nttdata.com>
  parent: Fujii Masao <masao.fujii@oss.nttdata.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Fujii Masao @ 2025-05-26 03:56 UTC (permalink / raw)
  To: Kevin K Biju <kevinkbiju@gmail.com>; +Cc: pgsql-docs@lists.postgresql.org



On 2025/05/23 23:46, Fujii Masao wrote:
> 
> 
> On 2025/05/23 19:52, Kevin K Biju wrote:
>> Hi Fuiji,
>>
>> I wasn't aware that support for exporting snapshots goes as far back as v10. The change looks good.
> 
> Thanks for the review!
> 
> I've prepared two patches: one for v15 and later, and another for v13 and v14.
> Unless there are any objections, I'll go ahead and commit and back-patch the patch
> to all supported branches.

I've pushed the patch. Thanks!

Regards,

-- 
Fujii Masao
NTT DATA Japan Corporation






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2025-05-26 03:56 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-05-22 11:53 Hot standbys now support exporting snapshots while creating a logical replication slot PG Doc comments form <noreply@postgresql.org>
2025-05-23 01:42 ` Fujii Masao <masao.fujii@oss.nttdata.com>
2025-05-23 10:52   ` Kevin K Biju <kevinkbiju@gmail.com>
2025-05-23 14:46     ` Fujii Masao <masao.fujii@oss.nttdata.com>
2025-05-26 03:56       ` Fujii Masao <masao.fujii@oss.nttdata.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox