postgresql/src
Amit Kapila f6429bd7db Fix xmin advancement during fast_forward decoding.
During logical decoding, we advance catalog_xmin of logical too early in
fast_forward mode, resulting in required catalog data being removed by
vacuum. This mode is normally used to advance the slot without processing
the changes, but we still can't let the slot's xmin to advance to an
incorrect value.

Commit f49a80c481 fixed a similar issue where the logical slot's
catalog_xmin was getting advanced prematurely during non-fast-forward
mode. During xl_running_xacts processing, instead of directly advancing
the slot's xmin to the oldest running xid in the record, it allowed the
xmin to be held back for snapshots that can be used for
not-yet-replayed transactions, as those might consider older txns as
running too. However, it missed the fact that the same problem can happen
during fast_forward mode decoding, as we won't build a base snapshot in
that mode, and the future call to get_changes from the same slot can miss
seeing the required catalog changes leading to incorrect reslts.

This commit allows building the base snapshot even in fast_forward mode to
prevent the early advancement of xmin.

Reported-by: Amit Kapila <amit.kapila16@gmail.com>
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/CAA4eK1LqWncUOqKijiafe+Ypt1gQAQRjctKLMY953J79xDBgAg@mail.gmail.com
Discussion: https://postgr.es/m/OS0PR01MB57163087F86621D44D9A72BF94BB2@OS0PR01MB5716.jpnprd01.prod.outlook.com
2025-04-28 10:56:24 +05:30
..
backend Fix xmin advancement during fast_forward decoding. 2025-04-28 10:56:24 +05:30
bin Fix pg_dump --clean with partitioned indexes. 2025-04-16 13:31:44 -04:00
common Add pg_encoding_set_invalid() 2025-02-10 10:03:39 -05:00
fe_utils In fmtIdEnc(), handle failure of enlargePQExpBuffer(). 2025-02-16 12:46:35 -05:00
include Fix race with synchronous_standby_names at startup 2025-04-11 10:02:18 +09:00
interfaces Translation updates 2025-02-17 17:51:30 +01:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Fix plpgsql's handling of simple expressions in scrollable cursors. 2025-03-21 11:30:42 -04:00
port Fix detection and handling of strchrnul() for macOS 15.4. 2025-04-01 16:49:51 -04:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:28:55 -04:00
test Test restartpoints in archive recovery. 2025-04-20 08:28:52 -07:00
timezone Update time zone data files to tzdata release 2025a. 2025-01-20 16:49:15 -05:00
tools Fix detection and handling of strchrnul() for macOS 15.4. 2025-04-01 16:49:51 -04:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Suppress macOS warnings about duplicate libraries in link commands. 2023-09-29 14:07:30 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00