Re: [15] Custom WAL resource managers, single user mode, and recovery - Mailing list pgsql-bugs

From Jeff Davis
Subject Re: [15] Custom WAL resource managers, single user mode, and recovery
Date
Msg-id 5f35eb43799f99ec49d0280a8628e88c0932cad4.camel@j-davis.com
Whole thread Raw
In response to Re: [15] Custom WAL resource managers, single user mode, and recovery  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, 2022-07-14 at 20:48 -0400, Tom Lane wrote:
> I think that the patch might be missing some stuff.  In postmaster.c,
> there are several steps after process_shared_preload_libraries()
> that look to be there to support loadable libraries, such as
> process_shmem_requests().  Wouldn't it be reasonable to expect
> that a loadable library would malfunction without those?

New patch attached.

This can also be a problem for custom table AMs, if the AM is expecting
to be loaded in shared_preload_libraries. For instance, it would be
reasonable for a module to have in _PG_init() something like:

  if (!process_shared_preload_libraries_in_progress)
    elog(ERROR, "module must be loaded in shared_preload_libraries");

to ensure hooks are properly configured at the right time. But if the
module does something like that, and also implements a custom table AM,
then it breaks single-user mode entirely because you can no longer do a
database-wide VACUUM.

I'm debating whether to backport this just to v15, where custom wal
resource managers were introduced, or all the way back to v12, where
custom table AMs were introduced. I'm inclined to just go to 15,
because the issue with table AMs is more of a gotcha than a real bug.

Regards,
    Jeff Davis


Attachment

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Makefile.global will override configure parameters if "pgsql" and "postgres" appear anywhere in the source path name
Next
From: Andres Freund
Date:
Subject: Re: Makefile.global will override configure parameters if "pgsql" and "postgres" appear anywhere in the source path name