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

Commit0d3c3aa

Browse files
committed
Use procsignal_sigusr1_handler for auxiliary processes.
AuxiliaryProcessMain does ProcSignalInit, so one might expect thatauxiliary processes would need to respond to SendProcSignal, but noneof the auxiliary processes do that. Change them to useprocsignal_sigusr1_handler instead of their own private handlers sothat they do. Besides seeming more correct, this is also less code. Itshouldn't make any functional difference right now because, as far aswe know, there are no current cases where SendProcSignal targets anauxiliary process, but there are plans to change that in the future.Andres FreundDiscussion:http://postgr.es/m/20181030051643.elbxjww5jjgnjaxg@alap3.anarazel.de
1 parent9af34f3 commit0d3c3aa

File tree

5 files changed

+11
-69
lines changed

5 files changed

+11
-69
lines changed

‎src/backend/postmaster/bgwriter.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include"storage/ipc.h"
5252
#include"storage/lwlock.h"
5353
#include"storage/proc.h"
54+
#include"storage/procsignal.h"
5455
#include"storage/shmem.h"
5556
#include"storage/smgr.h"
5657
#include"storage/spin.h"
@@ -96,7 +97,6 @@ static volatile sig_atomic_t shutdown_requested = false;
9697
staticvoidbg_quickdie(SIGNAL_ARGS);
9798
staticvoidBgSigHupHandler(SIGNAL_ARGS);
9899
staticvoidReqShutdownHandler(SIGNAL_ARGS);
99-
staticvoidbgwriter_sigusr1_handler(SIGNAL_ARGS);
100100

101101

102102
/*
@@ -114,18 +114,15 @@ BackgroundWriterMain(void)
114114
WritebackContextwb_context;
115115

116116
/*
117-
* Properly accept or ignore signals the postmaster might send us.
118-
*
119-
* bgwriter doesn't participate in ProcSignal signalling, but a SIGUSR1
120-
* handler is still needed for latch wakeups.
117+
* Properly accept or ignore signals that might be sent to us.
121118
*/
122119
pqsignal(SIGHUP,BgSigHupHandler);/* set flag to read config file */
123120
pqsignal(SIGINT,SIG_IGN);
124121
pqsignal(SIGTERM,ReqShutdownHandler);/* shutdown */
125122
pqsignal(SIGQUIT,bg_quickdie);/* hard crash time */
126123
pqsignal(SIGALRM,SIG_IGN);
127124
pqsignal(SIGPIPE,SIG_IGN);
128-
pqsignal(SIGUSR1,bgwriter_sigusr1_handler);
125+
pqsignal(SIGUSR1,procsignal_sigusr1_handler);
129126
pqsignal(SIGUSR2,SIG_IGN);
130127

131128
/*
@@ -427,14 +424,3 @@ ReqShutdownHandler(SIGNAL_ARGS)
427424

428425
errno=save_errno;
429426
}
430-
431-
/* SIGUSR1: used for latch wakeups */
432-
staticvoid
433-
bgwriter_sigusr1_handler(SIGNAL_ARGS)
434-
{
435-
intsave_errno=errno;
436-
437-
latch_sigusr1_handler();
438-
439-
errno=save_errno;
440-
}

‎src/backend/postmaster/checkpointer.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include"storage/ipc.h"
5555
#include"storage/lwlock.h"
5656
#include"storage/proc.h"
57+
#include"storage/procsignal.h"
5758
#include"storage/shmem.h"
5859
#include"storage/smgr.h"
5960
#include"storage/spin.h"
@@ -179,7 +180,6 @@ static void UpdateSharedMemoryConfig(void);
179180
staticvoidchkpt_quickdie(SIGNAL_ARGS);
180181
staticvoidChkptSigHupHandler(SIGNAL_ARGS);
181182
staticvoidReqCheckpointHandler(SIGNAL_ARGS);
182-
staticvoidchkpt_sigusr1_handler(SIGNAL_ARGS);
183183
staticvoidReqShutdownHandler(SIGNAL_ARGS);
184184

185185

@@ -211,7 +211,7 @@ CheckpointerMain(void)
211211
pqsignal(SIGQUIT,chkpt_quickdie);/* hard crash time */
212212
pqsignal(SIGALRM,SIG_IGN);
213213
pqsignal(SIGPIPE,SIG_IGN);
214-
pqsignal(SIGUSR1,chkpt_sigusr1_handler);
214+
pqsignal(SIGUSR1,procsignal_sigusr1_handler);
215215
pqsignal(SIGUSR2,ReqShutdownHandler);/* request shutdown */
216216

217217
/*
@@ -853,17 +853,6 @@ ReqCheckpointHandler(SIGNAL_ARGS)
853853
errno=save_errno;
854854
}
855855

856-
/* SIGUSR1: used for latch wakeups */
857-
staticvoid
858-
chkpt_sigusr1_handler(SIGNAL_ARGS)
859-
{
860-
intsave_errno=errno;
861-
862-
latch_sigusr1_handler();
863-
864-
errno=save_errno;
865-
}
866-
867856
/* SIGUSR2: set flag to run a shutdown checkpoint and exit */
868857
staticvoid
869858
ReqShutdownHandler(SIGNAL_ARGS)

‎src/backend/postmaster/startup.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include"storage/ipc.h"
3131
#include"storage/latch.h"
3232
#include"storage/pmsignal.h"
33+
#include"storage/procsignal.h"
3334
#include"storage/standby.h"
3435
#include"utils/guc.h"
3536
#include"utils/timeout.h"
@@ -50,7 +51,6 @@ static volatile sig_atomic_t in_restore_command = false;
5051

5152
/* Signal handlers */
5253
staticvoidstartupproc_quickdie(SIGNAL_ARGS);
53-
staticvoidStartupProcSigUsr1Handler(SIGNAL_ARGS);
5454
staticvoidStartupProcTriggerHandler(SIGNAL_ARGS);
5555
staticvoidStartupProcSigHupHandler(SIGNAL_ARGS);
5656

@@ -87,17 +87,6 @@ startupproc_quickdie(SIGNAL_ARGS)
8787
}
8888

8989

90-
/* SIGUSR1: let latch facility handle the signal */
91-
staticvoid
92-
StartupProcSigUsr1Handler(SIGNAL_ARGS)
93-
{
94-
intsave_errno=errno;
95-
96-
latch_sigusr1_handler();
97-
98-
errno=save_errno;
99-
}
100-
10190
/* SIGUSR2: set flag to finish recovery */
10291
staticvoid
10392
StartupProcTriggerHandler(SIGNAL_ARGS)
@@ -181,7 +170,7 @@ StartupProcessMain(void)
181170
pqsignal(SIGQUIT,startupproc_quickdie);/* hard crash time */
182171
InitializeTimeouts();/* establishes SIGALRM handler */
183172
pqsignal(SIGPIPE,SIG_IGN);
184-
pqsignal(SIGUSR1,StartupProcSigUsr1Handler);
173+
pqsignal(SIGUSR1,procsignal_sigusr1_handler);
185174
pqsignal(SIGUSR2,StartupProcTriggerHandler);
186175

187176
/*

‎src/backend/postmaster/walwriter.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include"storage/ipc.h"
5656
#include"storage/lwlock.h"
5757
#include"storage/proc.h"
58+
#include"storage/procsignal.h"
5859
#include"storage/smgr.h"
5960
#include"utils/guc.h"
6061
#include"utils/hsearch.h"
@@ -86,7 +87,6 @@ static volatile sig_atomic_t shutdown_requested = false;
8687
staticvoidwal_quickdie(SIGNAL_ARGS);
8788
staticvoidWalSigHupHandler(SIGNAL_ARGS);
8889
staticvoidWalShutdownHandler(SIGNAL_ARGS);
89-
staticvoidwalwriter_sigusr1_handler(SIGNAL_ARGS);
9090

9191
/*
9292
* Main entry point for walwriter process
@@ -114,7 +114,7 @@ WalWriterMain(void)
114114
pqsignal(SIGQUIT,wal_quickdie);/* hard crash time */
115115
pqsignal(SIGALRM,SIG_IGN);
116116
pqsignal(SIGPIPE,SIG_IGN);
117-
pqsignal(SIGUSR1,walwriter_sigusr1_handler);
117+
pqsignal(SIGUSR1,procsignal_sigusr1_handler);
118118
pqsignal(SIGUSR2,SIG_IGN);/* not used */
119119

120120
/*
@@ -337,14 +337,3 @@ WalShutdownHandler(SIGNAL_ARGS)
337337

338338
errno=save_errno;
339339
}
340-
341-
/* SIGUSR1: used for latch wakeups */
342-
staticvoid
343-
walwriter_sigusr1_handler(SIGNAL_ARGS)
344-
{
345-
intsave_errno=errno;
346-
347-
latch_sigusr1_handler();
348-
349-
errno=save_errno;
350-
}

‎src/backend/replication/walreceiver.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include"storage/ipc.h"
6464
#include"storage/pmsignal.h"
6565
#include"storage/procarray.h"
66+
#include"storage/procsignal.h"
6667
#include"utils/builtins.h"
6768
#include"utils/guc.h"
6869
#include"utils/pg_lsn.h"
@@ -125,7 +126,6 @@ static void ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime);
125126

126127
/* Signal handlers */
127128
staticvoidWalRcvSigHupHandler(SIGNAL_ARGS);
128-
staticvoidWalRcvSigUsr1Handler(SIGNAL_ARGS);
129129
staticvoidWalRcvShutdownHandler(SIGNAL_ARGS);
130130
staticvoidWalRcvQuickDieHandler(SIGNAL_ARGS);
131131

@@ -252,7 +252,7 @@ WalReceiverMain(void)
252252
pqsignal(SIGQUIT,WalRcvQuickDieHandler);/* hard crash time */
253253
pqsignal(SIGALRM,SIG_IGN);
254254
pqsignal(SIGPIPE,SIG_IGN);
255-
pqsignal(SIGUSR1,WalRcvSigUsr1Handler);
255+
pqsignal(SIGUSR1,procsignal_sigusr1_handler);
256256
pqsignal(SIGUSR2,SIG_IGN);
257257

258258
/* Reset some signals that are accepted by postmaster but not here */
@@ -766,17 +766,6 @@ WalRcvSigHupHandler(SIGNAL_ARGS)
766766
}
767767

768768

769-
/* SIGUSR1: used by latch mechanism */
770-
staticvoid
771-
WalRcvSigUsr1Handler(SIGNAL_ARGS)
772-
{
773-
intsave_errno=errno;
774-
775-
latch_sigusr1_handler();
776-
777-
errno=save_errno;
778-
}
779-
780769
/* SIGTERM: set flag for ProcessWalRcvInterrupts */
781770
staticvoid
782771
WalRcvShutdownHandler(SIGNAL_ARGS)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp