From: Julien Rouhaud <rjuju123@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Subject: Faulty HEAP_XMAX_LOCK_ONLY & HEAP_KEYS_UPDATED hintbit combination
Date: Sun, 24 Jan 2021 14:17:58 +0800
Message-ID: <20210124061758.GA11756@nol> (raw)
Hi,
While working on pg14 compatibility for an extension relying on an apparently
uncommon combination of FOR UPDATE and stored function calls, I hit some new
Asserts introduced in 866e24d47db (Extend amcheck to check heap pages):
+ /*
+ * Do not allow tuples with invalid combinations of hint bits to be placed
+ * on a page. These combinations are detected as corruption by the
+ * contrib/amcheck logic, so if you disable one or both of these
+ * assertions, make corresponding changes there.
+ */
+ Assert(!((tuple->t_data->t_infomask & HEAP_XMAX_LOCK_ONLY) &&
+ (tuple->t_data->t_infomask2 & HEAP_KEYS_UPDATED)));
I attach a simple self contained script to reproduce the problem, the last
UPDATE triggering the Assert.
I'm not really familiar with this part of the code, so it's not exactly clear
to me if some logic is missing in compute_new_xmax_infomask() /
heap_prepare_insert(), or if this should actually be an allowed combination of
hint bit.
Attachments:trigger_assert.sql (text/plain, 356B) download
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id integer, val text);
INSERT INTO t1 SELECT i, 'val' FROM generate_series(1, 500) i;
BEGIN;
SAVEPOINT s1;
SELECT 1 FROM t1 WHERE id = 123 FOR UPDATE;
UPDATE t1 SET val = 'hoho' WHERE id = 123;
release s1;
savepoint s1;
SELECT 1 FROM t1 WHERE id = 123 FOR UPDATE;
UPDATE t1 SET val = 'hoho' WHERE id = 123;
COMMIT;
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-hackers@postgresql.org
Cc: rjuju123@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Faulty HEAP_XMAX_LOCK_ONLY & HEAP_KEYS_UPDATED hintbit combination
In-Reply-To: <20210124061758.GA11756@nol>
* 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