Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd75288f

Browse files
committed
Make archiver process an auxiliary process.
This commit changes WAL archiver process so that it's treated asan auxiliary process and can use shared memory. This is an infrastructurepatch required for upcoming shared-memory based stats collector patchseries. These patch series basically need any processes including archiverthat can report the statistics to access to shared memory. Since this patchitself is useful to simplify the code and when users monitor the status ofarchiver, it's committed separately in advance.This commit simplifies the code for WAL archiving. For example, previouslybackends need to signal to archiver via postmaster when they notifyarchiver that there are some WAL files to archive. On the other hand,this commit removes that signal to postmaster and enables backends tonotify archier directly using shared latch.Also, as the side of this change, the information about archiver processbecomes viewable at pg_stat_activity view.Author: Kyotaro HoriguchiReviewed-by: Andres Freund, Álvaro Herrera, Julien Rouhaud, Tomas Vondra, Arthur Zakirov, Fujii MasaoDiscussion:https://postgr.es/m/20180629.173418.190173462.horiguchi.kyotaro@lab.ntt.co.jp
1 parent0ea71c9 commitd75288f

File tree

11 files changed

+162
-213
lines changed

11 files changed

+162
-213
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
935935
<literal>logical replication worker</literal>,
936936
<literal>parallel worker</literal>, <literal>background writer</literal>,
937937
<literal>client backend</literal>, <literal>checkpointer</literal>,
938+
<literal>archiver</literal>,
938939
<literal>startup</literal>, <literal>walreceiver</literal>,
939940
<literal>walsender</literal> and <literal>walwriter</literal>.
940941
In addition, background workers registered by extensions may have

‎src/backend/access/transam/xlogarchive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
#include"common/archive.h"
2626
#include"miscadmin.h"
2727
#include"postmaster/startup.h"
28+
#include"postmaster/pgarch.h"
2829
#include"replication/walsender.h"
2930
#include"storage/fd.h"
3031
#include"storage/ipc.h"
3132
#include"storage/lwlock.h"
32-
#include"storage/pmsignal.h"
3333

3434
/*
3535
* Attempt to retrieve the specified file from off-line archival storage.
@@ -491,7 +491,7 @@ XLogArchiveNotify(const char *xlog)
491491

492492
/* Notify archiver that it's got something to do */
493493
if (IsUnderPostmaster)
494-
SendPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER);
494+
PgArchWakeup();
495495
}
496496

497497
/*

‎src/backend/bootstrap/bootstrap.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ AuxiliaryProcessMain(int argc, char *argv[])
317317
caseStartupProcess:
318318
MyBackendType=B_STARTUP;
319319
break;
320+
caseArchiverProcess:
321+
MyBackendType=B_ARCHIVER;
322+
break;
320323
caseBgWriterProcess:
321324
MyBackendType=B_BG_WRITER;
322325
break;
@@ -437,30 +440,29 @@ AuxiliaryProcessMain(int argc, char *argv[])
437440
proc_exit(1);/* should never return */
438441

439442
caseStartupProcess:
440-
/* don't set signals, startup process has its own agenda */
441443
StartupProcessMain();
442-
proc_exit(1);/* should never return */
444+
proc_exit(1);
445+
446+
caseArchiverProcess:
447+
PgArchiverMain();
448+
proc_exit(1);
443449

444450
caseBgWriterProcess:
445-
/* don't set signals, bgwriter has its own agenda */
446451
BackgroundWriterMain();
447-
proc_exit(1);/* should never return */
452+
proc_exit(1);
448453

449454
caseCheckpointerProcess:
450-
/* don't set signals, checkpointer has its own agenda */
451455
CheckpointerMain();
452-
proc_exit(1);/* should never return */
456+
proc_exit(1);
453457

454458
caseWalWriterProcess:
455-
/* don't set signals, walwriter has its own agenda */
456459
InitXLOGAccess();
457460
WalWriterMain();
458-
proc_exit(1);/* should never return */
461+
proc_exit(1);
459462

460463
caseWalReceiverProcess:
461-
/* don't set signals, walreceiver has its own agenda */
462464
WalReceiverMain();
463-
proc_exit(1);/* should never return */
465+
proc_exit(1);
464466

465467
default:
466468
elog(PANIC,"unrecognized process type: %d", (int)MyAuxProcType);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp