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

Commit280c53e

Browse files
committed
A collection of small fixes for logical replication.
* Be sure to reset the launcher's pid (LogicalRepCtx->launcher_pid) to 0 even when the launcher emits an error.* Declare ApplyLauncherWakeup() as a static function because it's called only in launcher.c.* Previously IsBackendPId() was used to check whether the launcher's pid was valid. IsBackendPid() was necessary because there was the bug where the launcher's pid was not reset to 0. But now it's fixed, so IsBackendPid() is not necessary and this patch removes it.Author: Masahiko SawadaReviewed-by: Kyotaro HoriguchiReported-by: Fujii MasaoDiscussion:http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com
1 parent39a6772 commit280c53e

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

‎src/backend/replication/logical/launcher.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ typedef struct LogicalRepCtxStruct
7272

7373
LogicalRepCtxStruct*LogicalRepCtx;
7474

75+
staticvoidApplyLauncherWakeup(void);
76+
staticvoidlogicalrep_launcher_onexit(intcode,Datumarg);
7577
staticvoidlogicalrep_worker_onexit(intcode,Datumarg);
7678
staticvoidlogicalrep_worker_detach(void);
7779

@@ -480,6 +482,17 @@ logicalrep_worker_detach(void)
480482
LWLockRelease(LogicalRepWorkerLock);
481483
}
482484

485+
/*
486+
* Cleanup function for logical replication launcher.
487+
*
488+
* Called on logical replication launcher exit.
489+
*/
490+
staticvoid
491+
logicalrep_launcher_onexit(intcode,Datumarg)
492+
{
493+
LogicalRepCtx->launcher_pid=0;
494+
}
495+
483496
/*
484497
* Cleanup function.
485498
*
@@ -643,10 +656,10 @@ ApplyLauncherWakeupAtCommit(void)
643656
on_commit_launcher_wakeup= true;
644657
}
645658

646-
void
659+
staticvoid
647660
ApplyLauncherWakeup(void)
648661
{
649-
if (IsBackendPid(LogicalRepCtx->launcher_pid))
662+
if (LogicalRepCtx->launcher_pid!=0)
650663
kill(LogicalRepCtx->launcher_pid,SIGUSR1);
651664
}
652665

@@ -659,6 +672,8 @@ ApplyLauncherMain(Datum main_arg)
659672
ereport(DEBUG1,
660673
(errmsg("logical replication launcher started")));
661674

675+
before_shmem_exit(logicalrep_launcher_onexit, (Datum)0);
676+
662677
/* Establish signal handlers. */
663678
pqsignal(SIGHUP,logicalrep_worker_sighup);
664679
pqsignal(SIGTERM,logicalrep_worker_sigterm);

‎src/include/replication/logicallauncher.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ extern void ApplyLauncherMain(Datum main_arg);
2121
externSizeApplyLauncherShmemSize(void);
2222
externvoidApplyLauncherShmemInit(void);
2323

24-
externvoidApplyLauncherWakeup(void);
2524
externvoidApplyLauncherWakeupAtCommit(void);
2625
externvoidAtCommit_ApplyLauncher(void);
2726

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp