mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Remove set_latch_on_sigusr1 flag.
This flag has proven to be a recipe for bugs, and it doesn't seem like it can really buy anything in terms of performance. So let's just *always* set the process latch when we receive SIGUSR1 instead of trying to do it only when needed. Per my recent proposal on pgsql-hackers.
This commit is contained in:
@ -255,51 +255,38 @@ static void
|
||||
wait_for_workers_to_become_ready(worker_state *wstate,
|
||||
volatile test_shm_mq_header *hdr)
|
||||
{
|
||||
bool save_set_latch_on_sigusr1;
|
||||
bool result = false;
|
||||
|
||||
save_set_latch_on_sigusr1 = set_latch_on_sigusr1;
|
||||
set_latch_on_sigusr1 = true;
|
||||
|
||||
PG_TRY();
|
||||
for (;;)
|
||||
{
|
||||
for (;;)
|
||||
int workers_ready;
|
||||
|
||||
/* If all the workers are ready, we have succeeded. */
|
||||
SpinLockAcquire(&hdr->mutex);
|
||||
workers_ready = hdr->workers_ready;
|
||||
SpinLockRelease(&hdr->mutex);
|
||||
if (workers_ready >= wstate->nworkers)
|
||||
{
|
||||
int workers_ready;
|
||||
|
||||
/* If all the workers are ready, we have succeeded. */
|
||||
SpinLockAcquire(&hdr->mutex);
|
||||
workers_ready = hdr->workers_ready;
|
||||
SpinLockRelease(&hdr->mutex);
|
||||
if (workers_ready >= wstate->nworkers)
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If any workers (or the postmaster) have died, we have failed. */
|
||||
if (!check_worker_status(wstate))
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Wait to be signalled. */
|
||||
WaitLatch(MyLatch, WL_LATCH_SET, 0);
|
||||
|
||||
/* An interrupt may have occurred while we were waiting. */
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
/* Reset the latch so we don't spin. */
|
||||
ResetLatch(MyLatch);
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If any workers (or the postmaster) have died, we have failed. */
|
||||
if (!check_worker_status(wstate))
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Wait to be signalled. */
|
||||
WaitLatch(MyLatch, WL_LATCH_SET, 0);
|
||||
|
||||
/* An interrupt may have occurred while we were waiting. */
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
/* Reset the latch so we don't spin. */
|
||||
ResetLatch(MyLatch);
|
||||
}
|
||||
PG_CATCH();
|
||||
{
|
||||
set_latch_on_sigusr1 = save_set_latch_on_sigusr1;
|
||||
PG_RE_THROW();
|
||||
}
|
||||
PG_END_TRY();
|
||||
|
||||
if (!result)
|
||||
ereport(ERROR,
|
||||
|
Reference in New Issue
Block a user