]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix locking when fixing an incomplete split of a GIN internal page
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 29 Jan 2024 11:46:22 +0000 (13:46 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 29 Jan 2024 11:46:45 +0000 (13:46 +0200)
commite74c916657b56e062e244be97ea17c57c178ade0
tree124bdb1a918783552f4adbad5bdd257ca42aea96
parent425127bed2e72c0596fd35b976fde569f64f814d
Fix locking when fixing an incomplete split of a GIN internal page

ginFinishSplit() expects the caller to hold an exclusive lock on the
buffer, but when finishing an earlier "leftover" incomplete split of
an internal page, the caller held a shared lock. That caused an
assertion failure in MarkBufferDirty(). Without assertions, it could
lead to corruption if two backends tried to complete the split at the
same time.

On master, add a test case using the new injection point facility.

Report and analysis by Fei Changhong. Backpatch the fix to all
supported versions.

Reviewed-by: Fei Changhong, Michael Paquier
Discussion: https://www.postgresql.org/message-id/tencent_A3CE810F59132D8E230475A5F0F7A08C8307@qq.com
src/backend/access/gin/ginbtree.c