From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Chao Li <li.evan.chao@gmail.com>
Cc: Kirill Reshke <reshkekirill@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Melanie Plageman <melanieplageman@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers@postgresql.org, Thomas Munro <thomas.munro@gmail.com>
Cc: Noah Misch <noah@leadboat.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)
Date: Thu, 15 Jan 2026 18:02:34 -0500
Message-ID: <934395.1768518154@sss.pgh.pa.us> (raw)
In-Reply-To: <wat7azo4hpgux7ptvozfedtw6hnz7pih3vvnfipxdlcci6fuf3@wacut36qcac7>
References: <4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf>
<CALdSSPgyc7VuMLUZ8J7v2G-PebBa_vEi+mp-cLkcOwNycB56Hw@mail.gmail.com>
<kjdgvws34gpnz4y6xu5aaeul5mspgy3ahvyiw4lndb3ecsacdb@b2ccyowotpqh>
<jtg5cu4n6h5lib3kzx66ju4yhh6kmviaud7oq6dtut6c4q4rdi@xwsfoagt3c2b>
<9C2494E1-F446-42DF-B070-7E231B8E6221@gmail.com>
<vrnib3bf726ht72jlccu252qm65lzexutydtagytstsjszpiya@ece6xi7o4nfx>
<F6A52B41-2FFA-4592-BD9B-0438F610B6A2@gmail.com>
<cj5mcjdpucvw4a54hehslr3ctukavrbnxltvuzzhqnimvpju5e@cy3g3mnsefwz>
<58821140-0182-4FF3-9A4F-5B168DDB9243@gmail.com>
<732580B4-962F-4EBD-8811-F4667D79747D@gmail.com>
<wat7azo4hpgux7ptvozfedtw6hnz7pih3vvnfipxdlcci6fuf3@wacut36qcac7>
Various buildfarm animals are complaining about fcb9c977a,
similarly to this from calliphoridae [1]:
[969/2355] ccache gcc -Isrc/backend/postgres_lib.a.p -Isrc/include -I../pgsql/src/include -I/usr/include/libxml2 -fdiagnostics-color=never -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O2 -g -fno-strict-aliasing -fwrapv -fexcess-precision=standard -D_GNU_SOURCE -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -Wdeclaration-after-statement -Wmissing-variable-declarations -Wno-format-truncation -Wno-stringop-truncation -O1 -ggdb -g3 -fno-omit-frame-pointer -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-missing-field-initializers -DCOPY_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -fPIC -isystem /usr/include/mit-krb5 -pthread -DBUILDING_DLL -MD -MQ src/backend/postgres_lib.a.p/storage_buffer_bufmgr.c.o -MF src/backend/postgres_lib.a.p/storage_buffer_bufmgr.c.o.d -o src/backend/postgres_lib.a.p/storage_buffer_bufmgr.c.o -c ../pgsql/src/backend/storage/buffer/bufmgr.c
In file included from ../pgsql/src/include/pgstat.h:24,
from ../pgsql/src/backend/storage/buffer/bufmgr.c:52:
In function \342\200\230pgstat_report_wait_start\342\200\231,
inlined from \342\200\230BufferLockAcquire\342\200\231 at ../pgsql/src/backend/storage/buffer/bufmgr.c:5833:3:
../pgsql/src/include/utils/wait_event.h:75:49: warning: \342\200\230wait_event\342\200\231 may be used uninitialized [-Wmaybe-uninitialized]
75 | *(volatile uint32 *) my_wait_event_info = wait_event_info;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
../pgsql/src/backend/storage/buffer/bufmgr.c: In function \342\200\230BufferLockAcquire\342\200\231:
../pgsql/src/backend/storage/buffer/bufmgr.c:5781:33: note: \342\200\230wait_event\342\200\231 was declared here
5781 | uint32 wait_event;
| ^~~~~~~~~~
Apparently they do not find the coding in this switch persuasive:
switch (mode)
{
case BUFFER_LOCK_EXCLUSIVE:
wait_event = WAIT_EVENT_BUFFER_EXCLUSIVE;
break;
case BUFFER_LOCK_SHARE_EXCLUSIVE:
wait_event = WAIT_EVENT_BUFFER_SHARE_EXCLUSIVE;
break;
case BUFFER_LOCK_SHARE:
wait_event = WAIT_EVENT_BUFFER_SHARED;
break;
case BUFFER_LOCK_UNLOCK:
pg_unreachable();
}
It's not clear to me whether that's more about not believing
pg_unreachable() or more about the lack of a default: case.
I see that this is a modification of code that existed before
fcb9c977a and wasn't being complained of, which makes it even
stranger.
regards, tom lane
[1] https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=calliphoridae&dt=2026-01-15%2019%3...
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: tgl@sss.pgh.pa.us, andres@anarazel.de, li.evan.chao@gmail.com, reshkekirill@gmail.com, hlinnaka@iki.fi, melanieplageman@gmail.com, boekewurm+postgres@gmail.com, thomas.munro@gmail.com, noah@leadboat.com, robertmhaas@gmail.com, michael.paquier@gmail.com
Subject: Re: Buffer locking is special (hints, checksums, AIO writes)
In-Reply-To: <934395.1768518154@sss.pgh.pa.us>
* 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