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

Commitc6fda5a

Browse files
committed
Eliminate one background-worker-related flag variable.
Teach sigusr1_handler() to use the same test for whether a workermight need to be started as ServerLoop(). Aside from being perhapsa bit simpler, this prevents a potentially-unbounded delay whenstarting a background worker. On some platforms, select() doesn'treturn when interrupted by a signal, but is instead restarted,including a reset of the timeout to the originally-requested value.If signals arrive often enough, but no connection requests arrive,sigusr1_handler() will be executed repeatedly, but the body ofServerLoop() won't be reached. This change ensures that, even inthat case, background workers will eventually get launched.This is far from a perfect fix; really, we need select() to returncontrol to ServerLoop() after an interrupt, either via the self-pipetrick or some other mechanism. But that's going to require morework and discussion, so let's do this for now to at least mitigatethe damage.Per investigation of test_shm_mq failures on buildfarm member anole.
1 parentbb7c8f9 commitc6fda5a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4757,15 +4757,14 @@ static void
47574757
sigusr1_handler(SIGNAL_ARGS)
47584758
{
47594759
intsave_errno=errno;
4760-
boolstart_bgworker= false;
47614760

47624761
PG_SETMASK(&BlockSig);
47634762

47644763
/* Process background worker state change. */
47654764
if (CheckPostmasterSignal(PMSIGNAL_BACKGROUND_WORKER_CHANGE))
47664765
{
47674766
BackgroundWorkerStateChange();
4768-
start_bgworker= true;
4767+
StartWorkerNeeded= true;
47694768
}
47704769

47714770
/*
@@ -4806,10 +4805,10 @@ sigusr1_handler(SIGNAL_ARGS)
48064805

48074806
pmState=PM_HOT_STANDBY;
48084807
/* Some workers may be scheduled to start now */
4809-
start_bgworker= true;
4808+
StartWorkerNeeded= true;
48104809
}
48114810

4812-
if (start_bgworker)
4811+
if (StartWorkerNeeded||HaveCrashedWorker)
48134812
maybe_start_bgworker();
48144813

48154814
if (CheckPostmasterSignal(PMSIGNAL_WAKEN_ARCHIVER)&&

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp