pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: xliudut@gmail.com
Subject: BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait)
Date: Thu, 21 Nov 2024 10:35:47 +0000
Message-ID: <18719-da275243dd2e10e0@postgresql.org> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <18719-da275243dd2e10e0@postgresql.org>
Permalink:  ../18719-da275243dd2e10e0@postgresql.org/
Also on:    postgresql.org/message-id/18719-da275243dd2e10e0@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, xliudut@gmail.com
  Subject: Re: BUG #18719: Bug Report for Patch (For inplace update durability, make heap_update() callers wait)
  In-Reply-To: <18719-da275243dd2e10e0@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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