postgresql/src/include/access
Noah Misch 63f0198056 Fix data loss at inplace update after heap_update().
As previously-added tests demonstrated, heap_inplace_update() could
instead update an unrelated tuple of the same catalog.  It could lose
the update.  Losing relhasindex=t was a source of index corruption.
Inplace-updating commands like VACUUM will now wait for heap_update()
commands like GRANT TABLE and GRANT DATABASE.  That isn't ideal, but a
long-running GRANT already hurts VACUUM progress more just by keeping an
XID running.  The VACUUM will behave like a DELETE or UPDATE waiting for
the uncommitted change.

For implementation details, start at the systable_inplace_update_begin()
header comment and README.tuplock.  Back-patch to v12 (all supported
versions).  In back branches, retain a deprecated heap_inplace_update(),
for extensions.

Reported by Smolkin Grigory.  Reviewed by Nitin Motiani, (in earlier
versions) Heikki Linnakangas, and (in earlier versions) Alexander
Lakhin.

Discussion: https://postgr.es/m/CAMp+ueZQz3yDk7qg42hk6-9gxniYbp-=bG2mgqecErqR5gGGOA@mail.gmail.com
2024-09-24 15:25:22 -07:00
..
amapi.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
amvalidate.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
attmap.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
attnum.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
brin.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
brin_internal.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
brin_page.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
brin_pageops.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
brin_revmap.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
brin_tuple.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
brin_xlog.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
bufmask.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
clog.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
commit_ts.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
detoast.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
genam.h Fix data loss at inplace update after heap_update(). 2024-09-24 15:25:22 -07:00
generic_xlog.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
gin.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
gin_private.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
ginblock.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
ginxlog.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
gist.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
gist_private.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
gistscan.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
gistxlog.h Add info in WAL records in preparation for logical slot conflict handling 2023-04-02 12:32:19 -07:00
hash.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
hash_xlog.h Add info in WAL records in preparation for logical slot conflict handling 2023-04-02 12:32:19 -07:00
heapam.h Fix data loss at inplace update after heap_update(). 2024-09-24 15:25:22 -07:00
heapam_xlog.h Remove comment about xl_heap_inplace "AT END OF STRUCT". 2024-06-27 19:21:10 -07:00
heaptoast.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
hio.h hio: Take number of prior relation extensions into account 2023-08-14 09:54:38 -07:00
htup.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
htup_details.h New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
itup.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
multixact.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
nbtree.h Fix btmarkpos/btrestrpos array key wraparound bug. 2023-09-28 16:29:35 -07:00
nbtxlog.h Fix incorrect comment about nbtree WAL record. 2023-04-17 09:58:18 -07:00
parallel.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
printsimple.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
printtup.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
relation.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
reloptions.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
relscan.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
rewriteheap.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
rmgr.h Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
rmgrdesc_utils.h Fix various typos 2023-04-18 13:23:23 +12:00
rmgrlist.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
sdir.h Remove dead NoMovementScanDirection code 2023-02-01 10:52:41 +13:00
session.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
skey.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
slru.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
spgist.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
spgist_private.h Fix insertion of SP-GiST REDIRECT tuples during REINDEX CONCURRENTLY. 2024-06-17 14:30:59 -04:00
spgxlog.h Add info in WAL records in preparation for logical slot conflict handling 2023-04-02 12:32:19 -07:00
stratnum.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
subtrans.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
syncscan.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
sysattr.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
table.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tableam.h Fix the parameters order for TableAmRoutine.relation_copy_for_cluster() 2024-04-03 21:42:38 +03:00
timeline.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
toast_compression.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
toast_helper.h Fix typos in comments 2023-05-02 12:23:08 +09:00
toast_internals.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
transam.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tsmapi.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tupconvert.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tupdesc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tupdesc_details.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
tupmacs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
twophase.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
twophase_rmgr.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
valid.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
visibilitymap.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
visibilitymapdefs.h Add info in WAL records in preparation for logical slot conflict handling 2023-04-02 12:32:19 -07:00
xact.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xlog.h Allow logical decoding on standbys 2023-04-08 02:20:05 -07:00
xlog_internal.h Add info in WAL records in preparation for logical slot conflict handling 2023-04-02 12:32:19 -07:00
xlogarchive.h Revert refactoring of restore command code to shell_restore.c 2023-02-06 08:28:42 +09:00
xlogbackup.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xlogdefs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xloginsert.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xlogprefetcher.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xlogreader.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
xlogrecord.h Add more protections in WAL record APIs against overflows 2023-04-07 10:10:17 +09:00
xlogrecovery.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xlogstats.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
xlogutils.h Update copyright for 2023 2023-01-02 15:00:37 -05:00