postgresql/contrib
Masahiko Sawada cf2c69ec5a Fix possibility of logical decoding partial transaction changes.
When creating and initializing a logical slot, the restart_lsn is set
to the latest WAL insertion point (or the latest replay point on
standbys). Subsequently, WAL records are decoded from that point to
find the start point for extracting changes in the
DecodingContextFindStartpoint() function. Since the initial
restart_lsn could be in the middle of a transaction, the start point
must be a consistent point where we won't see the data for partial
transactions.

Previously, when not building a full snapshot, serialized snapshots
were restored, and the SnapBuild jumps to the consistent state even
while finding the start point. Consequently, the slot's restart_lsn
and confirmed_flush could be set to the middle of a transaction. This
could lead to various unexpected consequences. Specifically, there
were reports of logical decoding decoding partial transactions, and
assertion failures occurred because only subtransactions were decoded
without decoding their top-level transaction until decoding the commit
record.

To resolve this issue, the changes prevent restoring the serialized
snapshot and jumping to the consistent state while finding the start
point.

On v17 and HEAD, a flag indicating whether snapshot restores should be
skipped has been added to the SnapBuild struct, and SNAPBUILD_VERSION
has been bumpded.

On backbranches, the flag is stored in the LogicalDecodingContext
instead, preserving on-disk compatibility.

Backpatch to all supported versions.

Reported-by: Drew Callahan
Reviewed-by: Amit Kapila, Hayato Kuroda
Discussion: https://postgr.es/m/2444AA15-D21B-4CCE-8052-52C7C2DAFE5C%40amazon.com
Backpatch-through: 12
2024-07-11 22:48:10 +09:00
..
adminpack
amcheck Backport BackgroundPsql perl test module 2024-06-27 19:01:23 +03:00
auth_delay
auto_explain
bloom Replace RelationOpenSmgr() with RelationGetSmgr(). 2022-11-17 16:54:30 -05:00
bool_plperl
btree_gin btree_gin: Fix calculation of leftmost interval value. 2023-10-29 11:14:34 +00:00
btree_gist
citext CREATE INDEX: use the original userid for more ACL checks. 2022-06-25 09:07:45 -07:00
cube
dblink
dict_int
dict_xsyn
earthdistance
file_fdw
fuzzystrmatch Ensure Soundex difference() function handles empty input sanely. 2023-05-16 10:53:42 -04:00
hstore hstore: Tighten key/value parsing check for whitespaces 2023-06-12 09:14:17 +09:00
hstore_plperl
hstore_plpython In hstore_plpython, avoid crashing when return value isn't a mapping. 2023-04-27 11:55:06 -04:00
intagg
intarray Fix integer-overflow problem in intarray's g_int_decompress(). 2024-01-07 15:19:50 -05:00
isn
jsonb_plperl
jsonb_plpython
lo
ltree Validate ltree siglen GiST option to be int-aligned 2023-04-23 14:00:16 +03:00
ltree_plpython
oid2name
pageinspect pageinspect: Fix failure with hash_bitmap_info() for partitioned indexes 2023-12-19 18:19:19 +09:00
passwordcheck
pg_buffercache
pg_freespacemap
pg_prewarm Replace RelationOpenSmgr() with RelationGetSmgr(). 2022-11-17 16:54:30 -05:00
pg_standby
pg_stat_statements pg_stat_statements: fetch stmt location/length before it disappears. 2022-11-01 12:48:01 -04:00
pg_trgm Fix misbehavior in contrib/pg_trgm with an unsatisfiable regex. 2023-03-11 12:15:41 -05:00
pg_visibility Replace RelationOpenSmgr() with RelationGetSmgr(). 2022-11-17 16:54:30 -05:00
pgcrypto pgcrypto: Fix check for buffer size 2024-01-30 11:15:46 +01:00
pgrowlocks Adjust the order of the prechecks in pgrowlocks() 2023-10-31 16:44:00 +13:00
pgstattuple pgstattuple: Fix failure with pgstathashindex() for partitioned indexes 2023-12-19 15:20:53 +09:00
postgres_fdw postgres_fdw: Refuse to send FETCH FIRST WITH TIES to remote servers. 2024-06-07 17:45:08 +09:00
seg Replace last PushOverrideSearchPath() call with set_config_option(). 2023-05-08 06:14:12 -07:00
sepgsql Adjust sepgsql expected output for 681d9e462 et al. 2023-05-08 11:24:47 -04:00
spi
sslinfo
start-scripts
tablefunc
tcn
test_decoding Fix possibility of logical decoding partial transaction changes. 2024-07-11 22:48:10 +09:00
tsm_system_rows
tsm_system_time
unaccent unaccent: Tweak value of PYTHON when building without Python support 2023-09-27 14:41:26 +09:00
uuid-ossp Reject bogus output from uuid_create(3). 2022-09-09 12:41:36 -04:00
vacuumlo
xml2 xml2: Replace deprecated routines with recommended ones 2024-04-16 12:26:17 +09:00
contrib-global.mk
Makefile
README

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.