pgsql: Fix abort and launcher state resets in data checksums launcher

Started by Daniel Gustafsson2 months ago1 messagescommitters
Jump to latest
#1Daniel Gustafsson
dgustafsson@postgresql.org

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 <noah@leadboat.com>
Reported-by: Robert Haas <robertmhaas@gmail.com>
Discussion: /messages/by-id/E15AC050-C4B5-488D-BB2D-3C7AC9F89EA8@yesql.se
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(-)