aio: Fix configuration reload in IO workers. master github/master
authorThomas Munro <[email protected]>
Sat, 12 Jul 2025 04:20:11 +0000 (16:20 +1200)
committerThomas Munro <[email protected]>
Sat, 12 Jul 2025 04:33:02 +0000 (16:33 +1200)
method_worker.c installed SignalHandlerForConfigReload, but it failed to
actually process reload requests.  That hasn't yet produced any concrete
problem reports in terms of GUC changes it should have cared about in
v18, but it was inconsistent.

It did cause problems for a couple of patches in development that need
IO workers to react to ALTER SYSTEM + pg_reload_conf().  Fix extracted
from one of those patches.

Back-patch to 18.

Reported-by: Dmitry Dolgov <[email protected]>
Discussion: https://postgr.es/m/sh5uqe4a4aqo5zkkpfy5fobe2rg2zzouctdjz7kou4t74c66ql%40yzpkxb7pgoxf

src/backend/storage/aio/method_worker.c

index 1ce1bcd57a00a0bc0f6bc2f9075bf902b63315a9..bf8f77e6ff60673dcc4af1f1b3c63d1a88b8c403 100644 (file)
@@ -575,6 +575,12 @@ IoWorkerMain(const void *startup_data, size_t startup_data_len)
        }
 
        CHECK_FOR_INTERRUPTS();
+
+       if (ConfigReloadPending)
+       {
+           ConfigReloadPending = false;
+           ProcessConfigFile(PGC_SIGHUP);
+       }
    }
 
    error_context_stack = errcallback.previous;