Fix cleanup lock acquisition in SPLIT_ALLOCATE_PAGE replay.
authorAmit Kapila <[email protected]>
Mon, 14 Nov 2022 04:31:14 +0000 (10:01 +0530)
committerAmit Kapila <[email protected]>
Mon, 14 Nov 2022 04:31:14 +0000 (10:01 +0530)
commit4dccccb37e0b87bc3f941ea2c7f0b9e51661bc79
tree49fe061d3af083c35beb63e57034907cb734a8e5
parent7dd39e9e80288f2f4ef2990c4f074010973b56cb
Fix cleanup lock acquisition in SPLIT_ALLOCATE_PAGE replay.

During XLOG_HASH_SPLIT_ALLOCATE_PAGE replay, we were checking for a
cleanup lock on the new bucket page after acquiring an exclusive lock on
it and raising a PANIC error on failure. However, it is quite possible
that checkpointer can acquire the pin on the same page before acquiring a
lock on it, and then the replay will lead to an error. So instead, directly
acquire the cleanup lock on the new bucket page during
XLOG_HASH_SPLIT_ALLOCATE_PAGE replay operation.

Reported-by: Andres Freund
Author: Robert Haas
Reviewed-By: Amit Kapila, Andres Freund, Vignesh C
Backpatch-through: 11
Discussion: https://postgr.es/m/20220810022617[email protected]
src/backend/access/hash/hash_xlog.c
src/backend/access/hash/hashpage.c