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 <[email protected]>
Discussion: 
https://postgr.es/m/B3C69B86-7F82-4111-B97F-0005497BB745%40yandex-team.ru
Reviewed-by: Andrey Borodin <[email protected]>
Reviewed-by: Aleksander Alekseev <[email protected]>
Reviewed-by: Kirill Reshke <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Reviewed-by: Thomas Munro <[email protected]>
Reviewed-by: Tomas Vondra <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Reviewed-by: Yura Sokolov <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c13070a27b63d9ce4850d88a63bf889a6fde26f0

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(-)

Reply via email to