Make autovacuum launcher more responsive to pg_log_backend_memory_contexts().
authorFujii Masao <[email protected]>
Tue, 12 Oct 2021 00:50:17 +0000 (09:50 +0900)
committerFujii Masao <[email protected]>
Tue, 12 Oct 2021 00:50:17 +0000 (09:50 +0900)
Previously when pg_log_backend_memory_contexts() sent the request to
the autovacuum launcher, it could take more than several seconds to
log its memory contexts. Because the function (HandleAutoVacLauncherInterrupts)
to process any new interrupts that autovacuum launcher received
didn't handle the request for logging of memory contexts. This commit changes
the function so that it handles the request, to make autovacuum launcher
more responsitve to pg_log_backend_memory_contexts().

Back-patch to v14 where pg_log_backend_memory_contexts() was added.

Author: Koyu Tanigawa
Reviewed-by: Bharath Rupireddy, Atsushi Torikoshi
Discussion: https://postgr.es/m/0aae3e074face409b35153451be5cc11@oss.nttdata.com

src/backend/postmaster/autovacuum.c

index 3b3df8fa8cce3b4c60238659df920166c4f7f38f..96332320a737e67ab5c08a88c9ed6e56e5e29019 100644 (file)
@@ -836,6 +836,10 @@ HandleAutoVacLauncherInterrupts(void)
    if (ProcSignalBarrierPending)
        ProcessProcSignalBarrier();
 
+   /* Perform logging of memory contexts of this process */
+   if (LogMemoryContextPending)
+       ProcessLogMemoryContextInterrupt();
+
    /* Process sinval catchup interrupts that happened while sleeping */
    ProcessCatchupInterrupt();
 }