postgresql/src
Michael Paquier 341fba2a62 Fix ordering issue with WAL operations in GIN fast insert path
Contrary to what is documented in src/backend/access/transam/README,
ginHeapTupleFastInsert() had a few ordering issues with the way it does
its WAL operations when inserting items in its fast path.

First, when using a separate list, XLogBeginInsert() was being always
called before START_CRIT_SECTION(), and in this case a second thing was
wrong when merging lists, as an exclusive lock was taken on the tail
page *before* calling XLogBeginInsert().  Finally, when inserting items
into a tail page, the order of XLogBeginInsert() and
START_CRIT_SECTION() was reversed.  This commit addresses all these
issues by moving the calls of XLogBeginInsert() after all the pages
logged are locked and pinned, within a critical section.

This has been applied first only on HEAD as of 56b6625, but as per
discussion with Tom Lane and Álvaro Herrera, a backpatch is preferred to
keep all the branches consistent and to respect the transam's README
where we can.

Author:  Matthias van de Meent, Zhang Mingli
Discussion: https://postgr.es/m/CAEze2WhL8uLMqynnnCu1LAPwxD5RKEo0nHV+eXGg_N6ELU88HQ@mail.gmail.com
Backpatch-through: 10
2022-10-26 09:41:28 +09:00
..
backend Fix ordering issue with WAL operations in GIN fast insert path 2022-10-26 09:41:28 +09:00
bin pg_basebackup: Fix cross-platform tablespace relocation. 2022-10-21 09:05:57 -04:00
common Inhibit mingw CRT's auto-globbing of command line arguments 2022-04-25 15:51:27 -04:00
fe_utils Clean up assorted failures under clang's -fsanitize=undefined checks. 2022-03-03 18:13:24 -05:00
include pg_basebackup: Fix cross-platform tablespace relocation. 2022-10-21 09:05:57 -04:00
interfaces Fix possible omission of variable storage markers in ECPG. 2022-09-09 15:34:04 -04:00
makefiles Select CFLAGS_SL at configure time, not in platform-specific Makefiles. 2019-10-21 12:32:36 -04:00
pl Improve plpgsql's ability to handle arguments declared as RECORD. 2022-09-16 13:23:01 -04:00
port Stamp 11.17. 2022-08-08 16:49:00 -04:00
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:29:17 -04:00
test Yet further fixes for multi-row VALUES lists for updatable views. 2022-10-11 18:24:15 -04:00
timezone Update time zone data files to tzdata release 2022a. 2022-05-05 14:55:22 -04:00
tools Improve setup of environment values for commands in MSVC's vcregress.pl 2022-05-11 10:22:40 +09:00
tutorial tutorial: land height is "elevation", not "altitude" 2021-03-10 20:25:18 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Fix prove_installcheck to use correct paths when used with PGXS 2021-07-01 08:47:21 -04:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00