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

Commit635f580

Browse files
committed
Rename some signal and interrupt handling functions for consistency
The usual pattern for handling a signal is that the signal handlersets a flag and calls SetLatch(MyLatch), and CHECK_FOR_INTERRUPTS() orother code that is part of a wait loop calls another function to dealwith it. The naming of the functions involved was a bit inconsistent,however. CHECK_FOR_INTERRUPTS() calls ProcessInterrupts() to do theheavy-lifting, but the analogous functions in aux processes werecalled HandleMainLoopInterrupts(), HandleStartupProcInterrupts(),etc. Similarly, most subroutines of ProcessInterrupts() were calledProcess*(), but some were called Handle*().To make things less confusing, rename all the functions that are partof the overall signal/interrupt handling system but are not executedin a signal handler to e.g. ProcessSomething(), rather thanHandleSomething(). The "Process" prefix is now consistently used inthe non-signal-handler functions, and the "Handle" prefix in functionsthat are part of signal handlers, except for some completely unrelatedfunctions that clearly have nothing to do with signal or interrupthandling.Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>Discussion:https://www.postgresql.org/message-id/8a384b26-1499-41f6-be33-64b801fb98b8@iki.fi
1 parentf4e53e1 commit635f580

File tree

16 files changed

+54
-54
lines changed

16 files changed

+54
-54
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static const struct
158158
};
159159

160160
/* Private functions. */
161-
staticvoidHandleParallelMessage(ParallelContext*pcxt,inti,StringInfomsg);
161+
staticvoidProcessParallelMessage(ParallelContext*pcxt,inti,StringInfomsg);
162162
staticvoidWaitForParallelWorkersToExit(ParallelContext*pcxt);
163163
staticparallel_worker_main_typeLookupParallelWorkerFunction(constchar*libraryname,constchar*funcname);
164164
staticvoidParallelWorkerShutdown(intcode,Datumarg);
@@ -1031,7 +1031,7 @@ ParallelContextActive(void)
10311031
*
10321032
* Note: this is called within a signal handler! All we can do is set
10331033
* a flag that will cause the next CHECK_FOR_INTERRUPTS() to invoke
1034-
*HandleParallelMessages().
1034+
*ProcessParallelMessages().
10351035
*/
10361036
void
10371037
HandleParallelMessageInterrupt(void)
@@ -1042,10 +1042,10 @@ HandleParallelMessageInterrupt(void)
10421042
}
10431043

10441044
/*
1045-
*Handle any queued protocol messages received from parallel workers.
1045+
*Process any queued protocol messages received from parallel workers.
10461046
*/
10471047
void
1048-
HandleParallelMessages(void)
1048+
ProcessParallelMessages(void)
10491049
{
10501050
dlist_iteriter;
10511051
MemoryContextoldcontext;
@@ -1068,7 +1068,7 @@ HandleParallelMessages(void)
10681068
*/
10691069
if (hpm_context==NULL)/* first time through? */
10701070
hpm_context=AllocSetContextCreate(TopMemoryContext,
1071-
"HandleParallelMessages",
1071+
"ProcessParallelMessages",
10721072
ALLOCSET_DEFAULT_SIZES);
10731073
else
10741074
MemoryContextReset(hpm_context);
@@ -1111,7 +1111,7 @@ HandleParallelMessages(void)
11111111

11121112
initStringInfo(&msg);
11131113
appendBinaryStringInfo(&msg,data,nbytes);
1114-
HandleParallelMessage(pcxt,i,&msg);
1114+
ProcessParallelMessage(pcxt,i,&msg);
11151115
pfree(msg.data);
11161116
}
11171117
else
@@ -1131,10 +1131,10 @@ HandleParallelMessages(void)
11311131
}
11321132

11331133
/*
1134-
*Handle a single protocol message received from a single parallel worker.
1134+
*Process a single protocol message received from a single parallel worker.
11351135
*/
11361136
staticvoid
1137-
HandleParallelMessage(ParallelContext*pcxt,inti,StringInfomsg)
1137+
ProcessParallelMessage(ParallelContext*pcxt,inti,StringInfomsg)
11381138
{
11391139
charmsgtype;
11401140

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,7 @@ PerformWalRecovery(void)
17741774
#endif
17751775

17761776
/* Handle interrupt signals of startup process */
1777-
HandleStartupProcInterrupts();
1777+
ProcessStartupProcInterrupts();
17781778

17791779
/*
17801780
* Pause WAL replay, if requested by a hot-standby session via
@@ -2949,7 +2949,7 @@ recoveryPausesHere(bool endOfRecovery)
29492949
/* loop until recoveryPauseState is set to RECOVERY_NOT_PAUSED */
29502950
while (GetRecoveryPauseState()!=RECOVERY_NOT_PAUSED)
29512951
{
2952-
HandleStartupProcInterrupts();
2952+
ProcessStartupProcInterrupts();
29532953
if (CheckForStandbyTrigger())
29542954
return;
29552955

@@ -3038,7 +3038,7 @@ recoveryApplyDelay(XLogReaderState *record)
30383038
ResetLatch(&XLogRecoveryCtl->recoveryWakeupLatch);
30393039

30403040
/* This might change recovery_min_apply_delay. */
3041-
HandleStartupProcInterrupts();
3041+
ProcessStartupProcInterrupts();
30423042

30433043
if (CheckForStandbyTrigger())
30443044
break;
@@ -3727,7 +3727,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
37273727
now=GetCurrentTimestamp();
37283728

37293729
/* Handle interrupt signals of startup process */
3730-
HandleStartupProcInterrupts();
3730+
ProcessStartupProcInterrupts();
37313731
}
37323732
last_fail_time=now;
37333733
currentSource=XLOG_FROM_ARCHIVE;
@@ -4017,7 +4017,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess,
40174017
* This possibly-long loop needs to handle interrupts of startup
40184018
* process.
40194019
*/
4020-
HandleStartupProcInterrupts();
4020+
ProcessStartupProcInterrupts();
40214021
}
40224022

40234023
returnXLREAD_FAIL;/* not reached */
@@ -4695,7 +4695,7 @@ RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue
46954695

46964696
while (GetRecoveryPauseState()!=RECOVERY_NOT_PAUSED)
46974697
{
4698-
HandleStartupProcInterrupts();
4698+
ProcessStartupProcInterrupts();
46994699

47004700
if (CheckForStandbyTrigger())
47014701
{

‎src/backend/postmaster/autovacuum.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static WorkerInfo MyWorkerInfo = NULL;
316316
intAutovacuumLauncherPid=0;
317317

318318
staticOiddo_start_worker(void);
319-
staticvoidHandleAutoVacLauncherInterrupts(void);
319+
staticvoidProcessAutoVacLauncherInterrupts(void);
320320
staticvoidAutoVacLauncherShutdown(void)pg_attribute_noreturn();
321321
staticvoidlauncher_determine_sleep(boolcanlaunch,boolrecursing,
322322
structtimeval*nap);
@@ -594,7 +594,7 @@ AutoVacLauncherMain(const void *startup_data, size_t startup_data_len)
594594

595595
ResetLatch(MyLatch);
596596

597-
HandleAutoVacLauncherInterrupts();
597+
ProcessAutoVacLauncherInterrupts();
598598

599599
/*
600600
* a worker finished, or postmaster signaled failure to start a worker
@@ -742,7 +742,7 @@ AutoVacLauncherMain(const void *startup_data, size_t startup_data_len)
742742
* Process any new interrupts.
743743
*/
744744
staticvoid
745-
HandleAutoVacLauncherInterrupts(void)
745+
ProcessAutoVacLauncherInterrupts(void)
746746
{
747747
/* the normal shutdown case */
748748
if (ShutdownRequestPending)

‎src/backend/postmaster/bgwriter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ BackgroundWriterMain(const void *startup_data, size_t startup_data_len)
226226
/* Clear any already-pending wakeups */
227227
ResetLatch(MyLatch);
228228

229-
HandleMainLoopInterrupts();
229+
ProcessMainLoopInterrupts();
230230

231231
/*
232232
* Do one cycle of dirty-buffer writing.

‎src/backend/postmaster/checkpointer.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static pg_time_t last_xlog_switch_time;
157157

158158
/* Prototypes for private functions */
159159

160-
staticvoidHandleCheckpointerInterrupts(void);
160+
staticvoidProcessCheckpointerInterrupts(void);
161161
staticvoidCheckArchiveTimeout(void);
162162
staticboolIsCheckpointOnSchedule(doubleprogress);
163163
staticboolImmediateCheckpointRequested(void);
@@ -359,7 +359,7 @@ CheckpointerMain(const void *startup_data, size_t startup_data_len)
359359
*/
360360
AbsorbSyncRequests();
361361

362-
HandleCheckpointerInterrupts();
362+
ProcessCheckpointerInterrupts();
363363
if (ShutdownXLOGPending||ShutdownRequestPending)
364364
break;
365365

@@ -536,7 +536,7 @@ CheckpointerMain(const void *startup_data, size_t startup_data_len)
536536
* We may have received an interrupt during the checkpoint and the
537537
* latch might have been reset (e.g. in CheckpointWriteDelay).
538538
*/
539-
HandleCheckpointerInterrupts();
539+
ProcessCheckpointerInterrupts();
540540
if (ShutdownXLOGPending||ShutdownRequestPending)
541541
break;
542542
}
@@ -615,7 +615,7 @@ CheckpointerMain(const void *startup_data, size_t startup_data_len)
615615
/* Clear any already-pending wakeups */
616616
ResetLatch(MyLatch);
617617

618-
HandleCheckpointerInterrupts();
618+
ProcessCheckpointerInterrupts();
619619

620620
if (ShutdownRequestPending)
621621
break;
@@ -634,7 +634,7 @@ CheckpointerMain(const void *startup_data, size_t startup_data_len)
634634
* Process any new interrupts.
635635
*/
636636
staticvoid
637-
HandleCheckpointerInterrupts(void)
637+
ProcessCheckpointerInterrupts(void)
638638
{
639639
if (ProcSignalBarrierPending)
640640
ProcessProcSignalBarrier();

‎src/backend/postmaster/interrupt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ volatile sig_atomic_t ShutdownRequestPending = false;
3131
* Simple interrupt handler for main loops of background processes.
3232
*/
3333
void
34-
HandleMainLoopInterrupts(void)
34+
ProcessMainLoopInterrupts(void)
3535
{
3636
if (ProcSignalBarrierPending)
3737
ProcessProcSignalBarrier();
@@ -55,7 +55,7 @@ HandleMainLoopInterrupts(void)
5555
*
5656
* Normally, this handler would be used for SIGHUP. The idea is that code
5757
* which uses it would arrange to check the ConfigReloadPending flag at
58-
* convenient places inside main loops, or else callHandleMainLoopInterrupts.
58+
* convenient places inside main loops, or else callProcessMainLoopInterrupts.
5959
*/
6060
void
6161
SignalHandlerForConfigReload(SIGNAL_ARGS)
@@ -99,7 +99,7 @@ SignalHandlerForCrashExit(SIGNAL_ARGS)
9999
* SIGINT or SIGTERM.
100100
*
101101
* ShutdownRequestPending should be checked at a convenient place within the
102-
* main loop, or else the main loop should callHandleMainLoopInterrupts.
102+
* main loop, or else the main loop should callProcessMainLoopInterrupts.
103103
*/
104104
void
105105
SignalHandlerForShutdownRequest(SIGNAL_ARGS)

‎src/backend/postmaster/pgarch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static bool pgarch_archiveXlog(char *xlog);
147147
staticboolpgarch_readyXlog(char*xlog);
148148
staticvoidpgarch_archiveDone(char*xlog);
149149
staticvoidpgarch_die(intcode,Datumarg);
150-
staticvoidHandlePgArchInterrupts(void);
150+
staticvoidProcessPgArchInterrupts(void);
151151
staticintready_file_comparator(Datuma,Datumb,void*arg);
152152
staticvoidLoadArchiveLibrary(void);
153153
staticvoidpgarch_call_module_shutdown_cb(intcode,Datumarg);
@@ -324,7 +324,7 @@ pgarch_MainLoop(void)
324324
time_to_stop=ready_to_stop;
325325

326326
/* Check for barrier events and config update */
327-
HandlePgArchInterrupts();
327+
ProcessPgArchInterrupts();
328328

329329
/*
330330
* If we've gotten SIGTERM, we normally just sit and do nothing until
@@ -415,7 +415,7 @@ pgarch_ArchiverCopyLoop(void)
415415
* we'll adopt a new setting for archive_command as soon as
416416
* possible, even if there is a backlog of files to be archived.
417417
*/
418-
HandlePgArchInterrupts();
418+
ProcessPgArchInterrupts();
419419

420420
/* Reset variables that might be set by the callback */
421421
arch_module_check_errdetail_string=NULL;
@@ -856,7 +856,7 @@ pgarch_die(int code, Datum arg)
856856
* shutdown request is different between those loops.
857857
*/
858858
staticvoid
859-
HandlePgArchInterrupts(void)
859+
ProcessPgArchInterrupts(void)
860860
{
861861
if (ProcSignalBarrierPending)
862862
ProcessProcSignalBarrier();

‎src/backend/postmaster/startup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#ifndefUSE_POSTMASTER_DEATH_SIGNAL
3939
/*
4040
* On systems that need to make a system call to find out if the postmaster has
41-
* gone away, we'll do so only every Nth call toHandleStartupProcInterrupts().
41+
* gone away, we'll do so only every Nth call toProcessStartupProcInterrupts().
4242
* This only affects how long it takes us to detect the condition while we're
4343
* busy replaying WAL. Latch waits and similar which should react immediately
4444
* through the usual techniques.
@@ -149,9 +149,9 @@ StartupRereadConfig(void)
149149
StartupRequestWalReceiverRestart();
150150
}
151151

152-
/*Handle various signals that might be sent to the startup process */
152+
/*Process various signals that might be sent to the startup process */
153153
void
154-
HandleStartupProcInterrupts(void)
154+
ProcessStartupProcInterrupts(void)
155155
{
156156
#ifdefPOSTMASTER_POLL_RATE_LIMIT
157157
staticuint32postmaster_poll_count=0;

‎src/backend/postmaster/walsummarizer.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ intwal_summary_keep_time = 10 * HOURS_PER_DAY * MINS_PER_HOUR;
145145

146146
staticvoidWalSummarizerShutdown(intcode,Datumarg);
147147
staticXLogRecPtrGetLatestLSN(TimeLineID*tli);
148-
staticvoidHandleWalSummarizerInterrupts(void);
148+
staticvoidProcessWalSummarizerInterrupts(void);
149149
staticXLogRecPtrSummarizeWAL(TimeLineIDtli,XLogRecPtrstart_lsn,
150150
boolexact,XLogRecPtrswitch_lsn,
151151
XLogRecPtrmaximum_lsn);
@@ -356,7 +356,7 @@ WalSummarizerMain(const void *startup_data, size_t startup_data_len)
356356
MemoryContextReset(context);
357357

358358
/* Process any signals received recently. */
359-
HandleWalSummarizerInterrupts();
359+
ProcessWalSummarizerInterrupts();
360360

361361
/* If it's time to remove any old WAL summaries, do that now. */
362362
MaybeRemoveOldWalSummaries();
@@ -856,7 +856,7 @@ GetLatestLSN(TimeLineID *tli)
856856
* Interrupt handler for main loop of WAL summarizer process.
857857
*/
858858
staticvoid
859-
HandleWalSummarizerInterrupts(void)
859+
ProcessWalSummarizerInterrupts(void)
860860
{
861861
if (ProcSignalBarrierPending)
862862
ProcessProcSignalBarrier();
@@ -1016,7 +1016,7 @@ SummarizeWAL(TimeLineID tli, XLogRecPtr start_lsn, bool exact,
10161016
XLogRecord*record;
10171017
uint8rmid;
10181018

1019-
HandleWalSummarizerInterrupts();
1019+
ProcessWalSummarizerInterrupts();
10201020

10211021
/* We shouldn't go backward. */
10221022
Assert(summary_start_lsn <=xlogreader->EndRecPtr);
@@ -1503,7 +1503,7 @@ summarizer_read_local_xlog_page(XLogReaderState *state,
15031503
WALReadErrorerrinfo;
15041504
SummarizerReadLocalXLogPrivate*private_data;
15051505

1506-
HandleWalSummarizerInterrupts();
1506+
ProcessWalSummarizerInterrupts();
15071507

15081508
private_data= (SummarizerReadLocalXLogPrivate*)
15091509
state->private_data;
@@ -1541,7 +1541,7 @@ summarizer_read_local_xlog_page(XLogReaderState *state,
15411541
* current timeline, so more data might show up. Delay here
15421542
* so we don't tight-loop.
15431543
*/
1544-
HandleWalSummarizerInterrupts();
1544+
ProcessWalSummarizerInterrupts();
15451545
summarizer_wait_for_wal();
15461546

15471547
/* Recheck end-of-WAL. */
@@ -1692,7 +1692,7 @@ MaybeRemoveOldWalSummaries(void)
16921692
XLogRecPtroldest_lsn=InvalidXLogRecPtr;
16931693
TimeLineIDselected_tli;
16941694

1695-
HandleWalSummarizerInterrupts();
1695+
ProcessWalSummarizerInterrupts();
16961696

16971697
/*
16981698
* Pick a timeline for which some summary files still exist on disk,
@@ -1711,7 +1711,7 @@ MaybeRemoveOldWalSummaries(void)
17111711
{
17121712
WalSummaryFile*ws=lfirst(lc);
17131713

1714-
HandleWalSummarizerInterrupts();
1714+
ProcessWalSummarizerInterrupts();
17151715

17161716
/* If it's not on this timeline, it's not time to consider it. */
17171717
if (selected_tli!=ws->tli)

‎src/backend/postmaster/walwriter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ WalWriterMain(const void *startup_data, size_t startup_data_len)
239239
ResetLatch(MyLatch);
240240

241241
/* Process any signals received recently */
242-
HandleMainLoopInterrupts();
242+
ProcessMainLoopInterrupts();
243243

244244
/*
245245
* Do what we're here for; then, if XLogBackgroundFlush() found useful

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp