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

Commit981524d

Browse files
committed
Make archiver process handle barrier events.
Commitd75288f made WAL archiver process an auxiliary process.An auxiliary process needs to handle barrier events but the commitforgot to make archiver process do that.Reported-by: Thomas MunroAuthor: Fujii MasaoReviewed-by: Thomas MunroDiscussion:https://postgr.es/m/CA+hUKGLah2w1pWKHonZP_+EQw69=q56AHYwCgEN8GDzsRG_Hgw@mail.gmail.com
1 parentf80979f commit981524d

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

‎src/backend/postmaster/pgarch.c

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static bool pgarch_archiveXlog(char *xlog);
102102
staticboolpgarch_readyXlog(char*xlog);
103103
staticvoidpgarch_archiveDone(char*xlog);
104104
staticvoidpgarch_die(intcode,Datumarg);
105+
staticvoidHandlePgArchInterrupts(void);
105106

106107
/* Report shared memory space needed by PgArchShmemInit */
107108
Size
@@ -257,12 +258,8 @@ pgarch_MainLoop(void)
257258
/* When we get SIGUSR2, we do one more archive cycle, then exit */
258259
time_to_stop=ready_to_stop;
259260

260-
/* Check for config update */
261-
if (ConfigReloadPending)
262-
{
263-
ConfigReloadPending= false;
264-
ProcessConfigFile(PGC_SIGHUP);
265-
}
261+
/* Check for barrier events and config update */
262+
HandlePgArchInterrupts();
266263

267264
/*
268265
* If we've gotten SIGTERM, we normally just sit and do nothing until
@@ -355,15 +352,11 @@ pgarch_ArchiverCopyLoop(void)
355352
return;
356353

357354
/*
358-
* Check for config update. This is so that we'll adopt a new
359-
* setting for archive_command as soon as possible, even if there
360-
* is a backlog of files to be archived.
355+
* Check forbarrier events andconfig update. This is so that
356+
*we'll adopt a newsetting for archive_command as soon as
357+
*possible, even if thereis a backlog of files to be archived.
361358
*/
362-
if (ConfigReloadPending)
363-
{
364-
ConfigReloadPending= false;
365-
ProcessConfigFile(PGC_SIGHUP);
366-
}
359+
HandlePgArchInterrupts();
367360

368361
/* can't do anything if no command ... */
369362
if (!XLogArchiveCommandSet())
@@ -703,3 +696,23 @@ pgarch_die(int code, Datum arg)
703696
{
704697
PgArch->pgprocno=INVALID_PGPROCNO;
705698
}
699+
700+
/*
701+
* Interrupt handler for WAL archiver process.
702+
*
703+
* This is called in the loops pgarch_MainLoop and pgarch_ArchiverCopyLoop.
704+
* It checks for barrier events and config update, but not shutdown request
705+
* because how to handle shutdown request is different between those loops.
706+
*/
707+
staticvoid
708+
HandlePgArchInterrupts(void)
709+
{
710+
if (ProcSignalBarrierPending)
711+
ProcessProcSignalBarrier();
712+
713+
if (ConfigReloadPending)
714+
{
715+
ConfigReloadPending= false;
716+
ProcessConfigFile(PGC_SIGHUP);
717+
}
718+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp