pgsql: Avoid leaving DataChecksumState->worker_pid to an old value

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid leaving DataChecksumState->worker_pid to an old value
Date: 2026-06-24 12:39:39
Message-ID: E1wcMtH-0001eq-1H@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid leaving DataChecksumState->worker_pid to an old value

It might be left to an old value if the launcher was terminated while
a worker was running. launcher_exit() sends SIGTERM to the worker,
but did not clear 'worker_pid'. Clear it, to be tidy.

Also clear it in ProcessDatabase() before starting a new datachecksums
worker, to be sure we start from a clean slate. The codepath where
WaitForBackgroundWorkerStartup() returns BGWH_STOPPED but
worker_result != DATACHECKSUMSWORKER_SUCCESSFUL didn't clear it, while
all other codepaths did clear or set it.

Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Discussion: https://www.postgresql.org/message-id/b283fbb9-298e-4953-9120-eefaf24fae20@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c008b7ea10a5037bf9c6573283b97f4ba56d65c0

Modified Files
--------------
src/backend/postmaster/datachecksum_state.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-06-24 13:07:25 pgsql: Remove extraneous newlines from guc_parameters.dat
Previous Message Michael Paquier 2026-06-24 07:09:20 pgsql: Fix set of typos and grammar mistakes