postgresql/src/backend
Amit Kapila 21a7caeeb9 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 11:09:27 +05:30
..
access Fix GIN's shimTriConsistentFn to not corrupt its input. 2025-04-12 12:27:46 -04:00
archive Redesign archive modules 2023-02-17 14:26:42 +09:00
backup Skip .DS_Store files in server side utils 2024-02-13 13:47:12 +01:00
bootstrap Fix CREATE INDEX progress reporting for multi-level partitioning. 2023-03-25 15:34:03 -04:00
catalog Repair misbehavior with duplicate entries in FK SET column lists. 2025-04-04 20:11:48 -04:00
commands Avoid ERROR at ON COMMIT DELETE ROWS after relhassubclass=f. 2025-04-20 08:28:52 -07:00
executor Fix failure for generated column with a not-null domain constraint. 2025-04-15 12:08:34 -04:00
foreign Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:28 -07:00
jit Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:10 -05:00
lib Accommodate very large dshash tables. 2024-12-17 15:24:45 -06:00
libpq Fix regression in TLS session ticket disabling 2024-08-19 12:55:11 +02:00
main Fix elog(FATAL) before PostmasterMain() or just after fork(). 2024-12-10 13:52:02 -08:00
nodes Build whole-row Vars the same way during parsing and planning. 2025-03-12 11:47:19 -04:00
optimizer Fix issue with ORDER BY / DISTINCT aggregates and FILTER 2025-04-20 22:12:59 +12:00
parser Fix parse_cte.c's failure to examine sub-WITHs in DML statements. 2025-04-05 15:01:33 -04:00
partitioning Fix creation of partition descriptor during concurrent detach+drop 2024-08-12 18:17:56 -04:00
po Translation updates 2025-02-17 17:51:30 +01:00
port Close socket in case of errors in setting non-blocking 2024-01-17 11:24:11 +01:00
postmaster Don't ask for bug reports about pthread_is_threaded_np() != 0. 2025-01-23 14:23:29 -05:00
regex Avoid assertion due to disconnected NFA sub-graphs in regex parsing. 2024-11-15 18:23:38 -05:00
replication Fix xmin advancement during fast_forward decoding. 2025-04-28 11:09:27 +05:30
rewrite Handle default NULL insertion a little better. 2025-01-29 15:31:55 -05:00
snowball Avoid null pointer dereference crash after OOM in Snowball stemmers. 2025-02-18 21:23:59 -05:00
statistics Fix incorrectly reported stats kind in "can't happen" ERROR 2024-03-05 16:17:53 +13:00
storage doc: Correct description of values used in FSM for indexes 2025-03-27 10:20:47 +09:00
tcop Simplify executor's determination of whether to use parallelism. 2024-12-09 14:38:19 -05:00
tsearch Clear errno before calling strtol() in spell.c. 2025-03-08 11:24:47 -05:00
utils Avoid possibly-theoretical OOM crash hazard in hash_create(). 2025-04-23 16:04:42 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Fix make headerscheck 2024-04-27 11:38:41 +07:00
meson.build Add win32ver data to meson-built postgres.exe. 2023-06-12 07:40:38 -07:00
nls.mk Add missing gettext triggers 2023-05-10 13:51:51 +02:00