Simon Riggs <simon@2ndquadrant.com> writes:
> if (LWLockNumHeldByMe() == 0)
> pg_usleep(msec * 1000L);
> else
> elog(WARNING, "losing sleep because internal locks are held");
I did some testing yesterday with an Assert added to vacuum_delay_point:
Assert(InterruptHoldoffCount == 0 && CritSectionCount == 0);
which is basically asserting that ProcessInterrupts is allowed to
execute an interrupt. I desisted from committing this test, though,
because it's not clear that callers should not be allowed to call
vacuum_delay_point in such cases --- for the current callers it proved
fairly easy to locate the calls at places where this is certain to be OK,
but I don't want to wire in a requirement of it.
In any case, such tests don't help for the question of whether we've
missed any major loops that ought to contain vacuum_delay_point calls.
(If we were to add a worst-case-interval measurement, it might be
reasonable to not count calls that don't meet the ProcessInterrupts
condition.)
regards, tom lane