pgsql: Revert "Get rid of WALBufMappingLock"

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Revert "Get rid of WALBufMappingLock"
Date: 2025-08-22 16:32:20
Message-ID: E1upUge-0019nG-0P@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Revert "Get rid of WALBufMappingLock"

This reverts commit bc22dc0e0ddc2dcb6043a732415019cc6b6bf683.
It appears that conditional variables are not suitable for use inside
critical sections. If WaitLatch()/WaitEventSetWaitBlock() face postmaster
death, they exit, releasing all locks instead of PANIC. In certain
situations, this leads to data corruption.

Reported-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Discussion: https://postgr.es/m/B3C69B86-7F82-4111-B97F-0005497BB745%40yandex-team.ru
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Reviewed-by: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Reviewed-by: Tomas Vondra <tomas(at)vondra(dot)me>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2ce6abdf50857d3564cc1ef701e7f1095fbfb438

Modified Files
--------------
src/backend/access/transam/xlog.c | 234 +++++-------------------
src/backend/utils/activity/wait_event_names.txt | 2 +-
src/include/storage/lwlocklist.h | 2 +-
3 files changed, 49 insertions(+), 189 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2025-08-23 03:53:46 pgsql: Sort DO_DEFAULT_ACL dump objects independent of OIDs.
Previous Message Alexander Korotkov 2025-08-22 16:31:46 pgsql: Revert "Get rid of WALBufMappingLock"