Little checksum worker cleanups - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Little checksum worker cleanups
Date
Msg-id b283fbb9-298e-4953-9120-eefaf24fae20@iki.fi
Whole thread
Responses Re: Little checksum worker cleanups
List pgsql-hackers
Hi,

I had another fresh look at datachecksum_state.c while rebasing my 
"Interrupts vs signals" patch set, and spotted a few minor things that I 
think should be cleaned up. See commit messages for details.

Unless I'm missing something, the last patch fixes a bug, albeit a very 
theoretical one. The crux is that when the launcher exits, the worker 
might be left running; launcher_exit sends it SIGTERM but it might not 
exit instantly. If the launcher is restarted, and it launches a new 
worker while the old one is still running, the old launcher might set 
the worker's result field in shared memory, misleading the launcher to 
believe that the *new* worker succeeded.

That'd race condition would be really hard to hit in practice - I didn't 
even try to write a test - but it'd be nice to fix it. The patch adds a 
unique ID to each worker invocation to distinguish the old and new 
worker if both are running at the same time, ensuring that the old 
worker doesn't mess with the new worker's state.

- Heikki

Attachment

pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: [PATCH] Improving index selection for logical replication apply with replica identity full
Next
From: Kirk Wolak
Date:
Subject: Re: [GSoC 2026] - B-tree Index Bloat Reduction - Approach & Questions