pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait)
2+ messages / 2 participants
[nested] [flat]

* BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait)
@ 2024-11-21 10:35  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2024-11-21 10:35 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: xliudut@gmail.com

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait)
@ 2024-12-31 21:52  Noah Misch <noah@leadboat.com>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Noah Misch @ 2024-12-31 21:52 UTC (permalink / raw)
  To: xliudut@gmail.com; pgsql-bugs@lists.postgresql.org

Commit postgr.es/c/4ba84de fixed this.  I became aware of your report only
now, but it contained a great level of detail.  Thanks for writing it.





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-12-31 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-11-21 10:35 BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait) PG Bug reporting form <noreply@postgresql.org>
2024-12-31 21:52 ` Noah Misch <noah@leadboat.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox