| From: | Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com> |
|---|---|
| To: | Christoph Berg <myon(at)debian(dot)org> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Melanie Plageman <melanieplageman(at)gmail(dot)com> |
| Subject: | Re: pgsql: test_aio: Add basic tests for StartReadBuffers() |
| Date: | 2026-03-31 12:10:36 |
| Message-ID: | CAN55FZ2-bKNKmMSRDx1xH3SyqwBVMZ8HFG2YNipQ7LCdKm7eKA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers pgsql-hackers |
Hi,
On Tue, 31 Mar 2026 at 13:19, Christoph Berg <myon(at)debian(dot)org> wrote:
>
> One of the AIO commits around this one (2026-03-28 00:00Z) broke the
> postgresql-19 builds on apt.pg.o. Only the Debian unstable (sid,
> assertions enabled) builds are working, everything else including the
> nearly identical testing (forky) is broken (where assertions are off):
Thank you for the report! I can reproduce this when I disable
assertions. The problem is that, in StartReadBuffersImpl() in
bufmgr.c:
```
#ifdef USE_ASSERT_CHECKING
/*
* Initialize enough of ReadBuffersOperation to make
* CheckReadBuffersOperation() work. Outside of assertions
* that's not necessary when no IO is issued.
*/
operation->buffers = buffers;
operation->blocknum = blockNum;
operation->nblocks = 1;
operation->nblocks_done = 1;
CheckReadBuffersOperation(operation, true);
#endif
```
if (found) and if (i == 0) then we set operation->buffers and
operation->nblocks if the assertions are enabled but AIO tests expect
to read these values. So, read_buffers() in AIO tests read incorrect
values [1] when the assertions are disabled. Moving operation->buffers
and operation->nblocks outside of #ifdef USE_ASSERT_CHECKING like in
the attached fixes the problem.
[1]
read_buffers(PG_FUNCTION_ARGS)
{
...
for (int nio = 0; nio < nios; nio++)
{
ReadBuffersOperation *operation = &operations[nio];
int nblocks_this_io = operation->nblocks;
Datum values[6] = {0};
bool nulls[6] = {0};
ArrayType *buffers_arr;
/* convert buffer array to datum array */
for (int i = 0; i < nblocks_this_io; i++)
{
Buffer buf = operation->buffers[i];
...
}
--
Regards,
Nazir Bilal Yavuz
Microsoft
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Set-the-variables-that-callers-might-read-in-StartRe.patch | text/x-patch | 1.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2026-03-31 12:21:39 | Re: pgsql: Add fast path for foreign key constraint checks |
| Previous Message | Christoph Berg | 2026-03-31 10:18:49 | Re: pgsql: test_aio: Add basic tests for StartReadBuffers() |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2026-03-31 12:15:22 | Re: Eliminating SPI / SQL from some RI triggers - take 3 |
| Previous Message | Zhijie Hou (Fujitsu) | 2026-03-31 12:07:42 | RE: Initial COPY of Logical Replication is too slow |