Thread: BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait)
BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait)
From
PG Bug reporting form
Date:
The following bug has been logged on the website: Bug reference: 18719 Logged by: Daniels Evan Email address: xliudut@gmail.com PostgreSQL version: 16.5 Operating system: linux CentOS 7 Description: In the recently released REL_16_6 version, this patch (“For inplace update durability, make heap_update() callers wait”) has an issue that causes abnormal WARNING related to tablespace access. The reproduction steps are as follows: after compiling the code with this patch, execute the following script: CREATE ROLE grantee_test_another LOGIN; -- Assuming this path is valid \! mkdir -p /tmp/tablespace CREATE TABLESPACE tablespace_test_a OWNER granter_test LOCATION '/tmp/tablespace'; -- Disconnect and then reconnect, then execute this SQL GRANT ALL ON TABLESPACE tablespace_test_a to grantee_test_another; -- The following error is expected postgres=# GRANT ALL ON TABLESPACE tablespace_test_a to grantee_test_another; WARNING: you don't own a lock of type ExclusiveLock WARNING: tuple lock held at commit GRANT I conducted an initial investigation and found that the cause of this issue is the newly introduced function in the patch (SearchSysCacheLocked1), which has a problem: Oid dboid = SysCache[cacheId]->cc_relisshared ? InvalidOid : MyDatabaseId; When dealing with a TABLESPACE object, it incorrectly determines that MyDatabaseId exists and attaches it. As a result, during the LockAcquire phase, the LockTag is set to (5,1213,0,16), and during UnlockTuple->LockRelease, the LockTag becomes (0,1213,0,16). Below is a snippet of the log I printed during the verification of the issue: $tmp_polardb_pg_16_base/bin/psql psql (16.6) Type "help" for help. postgres=# GRANT ALL ON TABLESPACE tablespace_test_a to grantee_test_another; WARNING: Accquire: 0, 1213, 1 WARNING: Release: 0, 1213, 1 WARNING: Accquire: 0, 1213, 3 WARNING: Accquire: 0, 1213, 1 WARNING: Release: 0, 1213, 1 WARNING: Accquire: 0, 1213, 1 WARNING: Release: 0, 1213, 1 WARNING: Accquire: 5, 1213, 7 WARNING: Release: 0, 1213, 7 WARNING: you don't own a lock of type ExclusiveLock WARNING: Release: 0, 1213, 3 WARNING: tuple lock held at commit GRANT