Hi,
I'm currently investigating a reproducible deadlock involving concurrent regression tests (alter_table and domain), starting from commit 8319e5cb5.
While setting up a clean PostgreSQL 20devel environment to reproduce the issue, I ran into a separate bootstrap failure that I'm having trouble explaining.
I rebuilt and installed the current source tree, and verified that both binaries report PostgreSQL 20devel. I also verified that bthandler() in src/backend/access/nbtree/nbtree.c returns a static IndexAmRoutine, and that the generated FMGR table maps OID 330 to bthandler.
However, a completely fresh cluster fails during initdb:
$ rm -rf ~/pgdata-repro
$ ~/pg-install/bin/initdb -D ~/pgdata-repro
running bootstrap script ...
FATAL: index access method handler function 330 did not return an IndexAmRoutine struct
PANIC: cannot abort transaction 1, it was already committed
Aborted (core dumped)
initdb: removing data directory "/home/osama/pgdata-repro"
The relevant check appears to be in src/backend/access/index/amapi.c:
datum = OidFunctionCall0(amhandler);
routine = (const IndexAmRoutine *) DatumGetPointer(datum);
if (routine == NULL || !IsA(routine, IndexAmRoutine)) elog(ERROR, "index access method handler function %u did not return an IndexAmRoutine struct", amhandler);
I have not modified nbtree.c, and the generated catalog contains:
330 bthandler ... bthandler
and fmgrtab.c contains:
{ 330, 1, true, false, "bthandler", bthandler },
I initially suspected a stale build, but I forced a rebuild of the nbtree code and backend, reinstalled, and the failure persisted.
Could you point me toward what might cause bthandler() to fail the IsA(routine, IndexAmRoutine) check during bootstrap?
I want to make sure my development build is sound before continuing with the deadlock reproduction.
Thanks,
Osama Abdul Qader