pgsql: Flush logical slots to disk during a shutdown checkpoint if requ - Mailing list pgsql-committers

From Amit Kapila
Subject pgsql: Flush logical slots to disk during a shutdown checkpoint if requ
Date
Msg-id E1qgdGA-003ibL-G3@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Flush logical slots to disk during a shutdown checkpoint if required.

It's entirely possible for a logical slot to have a confirmed_flush LSN
higher than the last value saved on disk while not being marked as dirty.
Currently, it is not a major problem but a later patch adding support for
the upgrade of slots relies on that value being properly flushed to disk.

It can also help avoid processing the same transactions again in some
boundary cases after the clean shutdown and restart.  Say, we process
some transactions for which we didn't send anything downstream (the
changes got filtered) but the confirm_flush LSN is updated due to
keepalives.  As we don't flush the latest value of confirm_flush LSN, it
may lead to processing the same changes again without this patch.

The approach taken by this patch has been suggested by Ashutosh Bapat.

Author: Vignesh C, Julien Rouhaud, Kuroda Hayato
Reviewed-by: Amit Kapila, Dilip Kumar, Michael Paquier, Ashutosh Bapat, Peter Smith, Hou Zhijie
Discussion: http://postgr.es/m/CAA4eK1JzJagMmb_E8D4au=GYQkxox0AfNBm1FbP7sy7t4YWXPQ@mail.gmail.com
Discussion: http://postgr.es/m/TYAPR01MB58664C81887B3AF2EB6B16E3F5939@TYAPR01MB5866.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e0b2eed047df9045664da6f724cb42c10f8b12f0

Modified Files
--------------
src/backend/access/transam/xlog.c                  |   2 +-
src/backend/replication/slot.c                     |  37 +++++++-
src/include/replication/slot.h                     |   9 +-
src/test/recovery/meson.build                      |   1 +
.../recovery/t/038_save_logical_slots_shutdown.pl  | 102 +++++++++++++++++++++
5 files changed, 145 insertions(+), 6 deletions(-)


pgsql-committers by date:

Previous
From: Amit Kapila
Date:
Subject: pgsql: Remove redundant result assignment in 004_sync.pl.
Next
From: Michael Paquier
Date:
Subject: pgsql: Revert "Improve error message on snapshot import in snapmgr.c"