diff options
author | Michael Paquier <michael@paquier.xyz> | 2022-10-26 09:41:18 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2022-10-26 09:41:18 +0900 |
commit | 5a30d43fa9869adc5a6f708dd0994a8a4e53d905 (patch) | |
tree | d0a66cd0642d13cc040a30eec3ba69b7a602eb55 /src/backend/commands/functioncmds.c | |
parent | aaad8adb02ed20ebff9b60f1778d4a80d76e77c1 (diff) | |
download | postgresql-5a30d43fa9869adc5a6f708dd0994a8a4e53d905.tar.gz postgresql-5a30d43fa9869adc5a6f708dd0994a8a4e53d905.zip |
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
Diffstat (limited to 'src/backend/commands/functioncmds.c')
0 files changed, 0 insertions, 0 deletions