Re: Buffer locking is special (hints, checksums, AIO writes)

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)
Date: 2026-01-16 12:02:46
Message-ID: t4jhrtzfd2a3aabsppkfgr64fxy7i2457xj2w2gv3dbgqja3bz@xugvaeu2je2q
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-01-15 18:26:18 -0500, Andres Freund wrote:
> On 2026-01-15 18:19:41 -0500, Tom Lane wrote:
> > Andres Freund <andres(at)anarazel(dot)de> writes:
> > > Can't quite decide between just using always_inline - after all the buffer
> > > locking really is a rather crucial code path - and just initializing
> > > wait_event to 0. Either seems better than using a default:.
> >
> > Yeah, I agree with not using a default: in case we ever extend
> > the mode enum. I'd be inclined to fix it like this:
> >
> > case BUFFER_LOCK_UNLOCK:
> > pg_unreachable();
> > + /* silence possible compiler warning: */
> > + wait_event = 0;
> > }
>
> Unfortunately that doesn't seem to do the trick, at least not locally (gcc
> 14). I think gcc is considering the case where mode has a value outside of the
> known values of the enum. Hence needing initialize wait_event to zero in the
> declaration to avoid the warning.

I've now pushed the initialization of wait_event, as I'll be only semi-online
until late Monday.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Tkachenko 2026-01-16 12:10:27 Re: [BUG] [PATCH] pg_basebackup produces wrong incremental files after relation truncation in segmented tables
Previous Message Bertrand Drouvot 2026-01-16 11:37:55 Re: Flush some statistics within running transactions