]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid leaving DataChecksumState->worker_pid to an old value
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 24 Jun 2026 12:07:27 +0000 (15:07 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 24 Jun 2026 12:07:27 +0000 (15:07 +0300)
commitc008b7ea10a5037bf9c6573283b97f4ba56d65c0
tree3ca8541bfb4325cf65d577ed5a738023cadf620c
parent0edbf72f76833a145cb8eca128b775a8f0090d15
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@yesql.se>
Discussion: https://www.postgresql.org/message-id/b283fbb9-298e-4953-9120-eefaf24fae20@iki.fi
src/backend/postmaster/datachecksum_state.c