On Tue, Oct 14, 2025 at 5:00 PM Alexander Lakhin <[email protected]> wrote:
> The replacements doesn't work for me, unfortunately: I have 3 out of 30
> 027_stream_regress test runs failed:
> 2025-10-13 21:27:26.161 UTC [4181290:5] pg_regress/brin ERROR:  IO in wrong 
> state: 0
> 2025-10-13 21:27:26.161 UTC [4181290:6] pg_regress/brin STATEMENT: CREATE 
> TABLE brintest (byteacol bytea,

I wonder if the problem could be with buf->io_wref.  In WaitIO() we do:

        iow = buf->io_wref;
        UnlockBufHdr(buf, buf_state);
        ...
            pgaio_wref_wait(&iow);

... but UnlockBufHdr() is only concerned with write ordering:

static inline void
UnlockBufHdr(BufferDesc *desc, uint32 buf_state)
{
    pg_write_barrier();
    pg_atomic_write_u32(&desc->state, buf_state & (~BM_LOCKED));
}

What happens if you insert pg_memory_barrier() after the line that
reads buf->io_wref?

Does this reproduce on REL_18_STABLE?


Reply via email to