mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
Make archiver process an auxiliary process.
This commit changes WAL archiver process so that it's treated as an auxiliary process and can use shared memory. This is an infrastructure patch required for upcoming shared-memory based stats collector patch series. These patch series basically need any processes including archiver that can report the statistics to access to shared memory. Since this patch itself is useful to simplify the code and when users monitor the status of archiver, it's committed separately in advance. This commit simplifies the code for WAL archiving. For example, previously backends need to signal to archiver via postmaster when they notify archiver that there are some WAL files to archive. On the other hand, this commit removes that signal to postmaster and enables backends to notify archier directly using shared latch. Also, as the side of this change, the information about archiver process becomes viewable at pg_stat_activity view. Author: Kyotaro Horiguchi Reviewed-by: Andres Freund, Álvaro Herrera, Julien Rouhaud, Tomas Vondra, Arthur Zakirov, Fujii Masao Discussion: https://postgr.es/m/20180629.173418.190173462.horiguchi.kyotaro@lab.ntt.co.jp
This commit is contained in:
@ -317,6 +317,9 @@ AuxiliaryProcessMain(int argc, char *argv[])
|
||||
case StartupProcess:
|
||||
MyBackendType = B_STARTUP;
|
||||
break;
|
||||
case ArchiverProcess:
|
||||
MyBackendType = B_ARCHIVER;
|
||||
break;
|
||||
case BgWriterProcess:
|
||||
MyBackendType = B_BG_WRITER;
|
||||
break;
|
||||
@ -437,30 +440,29 @@ AuxiliaryProcessMain(int argc, char *argv[])
|
||||
proc_exit(1); /* should never return */
|
||||
|
||||
case StartupProcess:
|
||||
/* don't set signals, startup process has its own agenda */
|
||||
StartupProcessMain();
|
||||
proc_exit(1); /* should never return */
|
||||
proc_exit(1);
|
||||
|
||||
case ArchiverProcess:
|
||||
PgArchiverMain();
|
||||
proc_exit(1);
|
||||
|
||||
case BgWriterProcess:
|
||||
/* don't set signals, bgwriter has its own agenda */
|
||||
BackgroundWriterMain();
|
||||
proc_exit(1); /* should never return */
|
||||
proc_exit(1);
|
||||
|
||||
case CheckpointerProcess:
|
||||
/* don't set signals, checkpointer has its own agenda */
|
||||
CheckpointerMain();
|
||||
proc_exit(1); /* should never return */
|
||||
proc_exit(1);
|
||||
|
||||
case WalWriterProcess:
|
||||
/* don't set signals, walwriter has its own agenda */
|
||||
InitXLOGAccess();
|
||||
WalWriterMain();
|
||||
proc_exit(1); /* should never return */
|
||||
proc_exit(1);
|
||||
|
||||
case WalReceiverProcess:
|
||||
/* don't set signals, walreceiver has its own agenda */
|
||||
WalReceiverMain();
|
||||
proc_exit(1); /* should never return */
|
||||
proc_exit(1);
|
||||
|
||||
default:
|
||||
elog(PANIC, "unrecognized process type: %d", (int) MyAuxProcType);
|
||||
|
Reference in New Issue
Block a user