Re: pgsql: Revert online data checksum transitions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Masao Fujii <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Revert online data checksum transitions
Date: 2026-09-16 17:14:06
Message-ID: 506529.1789578846@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 16 Sep 2026, at 17:49, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I can poke into it on longfin's host if that would help.

> That would be great, thanks.

What seems to be happening is

(1) pg_control_checkpoint()'s local values[] and nulls[] arrays
are now of length 19.

(2) But the tupdesc that get_call_result_type() builds from the
pg_proc entry still has 20 columns.

(3) Therefore, heap_form_tuple sees a wrong value for the 19th column
(which does no great damage, since it's still a pass-by-value type)
and then fetches complete garbage from values[19] and nulls[19].

Depending on the stack layout and the phase of the moon, nulls[19]
might read as zero or it might not. Either case is fine so long as
heap_compute_data_size and heap_fill_tuple/fill_val interpret it the
same way. However, what I'm seeing as I trace through the crash on
longfin is that nulls[19] has a value that's not either 0 or 1 (not
too surprising), and somehow heap_compute_data_size is interpreting
that as "true" while fill_val is reading it as "false". According
to my understanding of the C standard, fill_val is in the wrong here.
I looked at the generated assembly code and could not spot exactly
what the problem is; it seems to be testing the byte value with

.loc 0 301 7 is_stmt 1 ## heaptuple.c:301:7
testb %al, %al
je LBB3_6

which certainly looks like it ought to treat all nonzero values alike.
Anyway this seems to be a code generation quirk of certain versions of
clang. It's probably not worth chasing further.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Jacob Champion 2026-09-16 17:33:57 Re: pgsql: Revert online data checksum transitions
Previous Message Daniel Gustafsson 2026-09-16 15:52:31 Re: pgsql: Revert online data checksum transitions

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-09-16 17:20:13 Re: Add TOAST statistics columns to pg_stat_all_tables
Previous Message Bharath Rupireddy 2026-09-16 17:02:50 Re: [PATCH] Release replication slot on error in SQL-callable slot functions