git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2f5c439)
Fix race condition in startup progress reporting.
2021年10月29日 18:40:15 +0000 (14:40 -0400)
2021年10月29日 18:40:15 +0000 (14:40 -0400)
Commit 9ce346eabf350a130bba46be3f8c50ba28506969 added startup
progress reporting, but begin_startup_progress_phase has a race
condition: the timeout for the previous phase might fire just
before we reschedule the interrupt for the next phase.

To avoid the race, disable the timeout, clear the flag, and then
re-enable the timeout.

Patch by me, reviewed by Nitin Jadhav.

Discussion: https://postgr.es/m/CA+TgmoYq38i6iAzfRLVxA6Cm+wMCf4WM8wC3o_a+X_JvWC8bJg@mail.gmail.com


diff --git a/src/backend/postmaster/startup.c b/src/backend/postmaster/startup.c
index 28e68dd8715ecbff85ae7cbc19785bd2a7caef87..47ec7378880ecc3230e73f159227e382104339d8 100644 (file)
--- a/src/backend/postmaster/startup.c
+++ b/src/backend/postmaster/startup.c
@@ -320,6 +320,8 @@ begin_startup_progress_phase(void)
if (log_startup_progress_interval == 0)
return;
+ disable_timeout(STARTUP_PROGRESS_TIMEOUT, false);
+ startup_progress_timer_expired = false;
startup_progress_phase_start_time = GetCurrentTimestamp();
fin_time = TimestampTzPlusMilliseconds(startup_progress_phase_start_time,
log_startup_progress_interval);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /