Fix abort and launcher state resets in data checksums launcher

The launcher_running flag was reset to false during shutdown, which
left a small window where a new launcher could be started when the
exit handler was still running.  Fix by only updating the running
flag in shared memory in the exit handler if our local copy is true.

Also reset the aborted state if the launch_operation changes during
shutdown to allow scenarios like "start -> abort -> start" to work
even if they reach the second start before the abort is fully done.

Issues found by Noah and Robert using AI assisted review with Claude.
Backpatch to v19 where the online checksums feature was introduced.

Reported-by: Noah Misch <[email protected]>
Reported-by: Robert Haas <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 19

Branch
------
master

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

Modified Files
--------------
src/backend/postmaster/datachecksum_state.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

Reply via email to