pgsql: Fix race condition in startup progress reporting.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix race condition in startup progress reporting.
Date: 2021-10-29 18:44:24
Message-ID: E1mgWrY-0001bR-5J@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix race condition in startup progress reporting.

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ccceb2946d4104804f8dca67515b602f5e78cdd

Modified Files
--------------
src/backend/postmaster/startup.c | 2 ++
1 file changed, 2 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2021-10-29 21:23:06 Re: pgsql: Report progress of startup operations that take a long time.
Previous Message Robert Haas 2021-10-29 18:09:48 pgsql: When fetching WAL for a basebackup, report errors with a sensibl