Re: VACUUM (INTERRUPTIBLE)? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: VACUUM (INTERRUPTIBLE)?
Date
Msg-id 20200909023040.riq7jvldvpvv7kl7@alap3.anarazel.de
Whole thread Raw
In response to Re: VACUUM (INTERRUPTIBLE)?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: VACUUM (INTERRUPTIBLE)?  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

On 2020-09-08 18:37:05 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > So it doesn't seem that useful to not make manual analyze interruptible?
> 
> I find the main attraction of this idea is that instead of saying
> "autovacuum/autoanalyze have these magic behaviors", we can say
> "autovacuum/autoanalyze use option FOO".  So whatever behavior
> autoanalyze has today, we should make available to manual analyze,
> without quibbling too hard over how much of a use-case there is.

Yea, I think that's a fair point. It's basically more work to
distinguish the two anyway.


It was fairly straight forward to implement the basics of
INTERRUPTIBLE. However it seems like it might not actually address my
main concern, i.e. making this reliably testable with isolation
tester. At least not the way I envisioned it...

My idea for the test was to have one isolationtester session start a
seqscan, which would then reliably block a concurrent VACUUM (FREEZE,
INTERRUPTIBLE). That'd then give a stable point to switch back to the
first session, which would interrupt the VACUUM by doing a LOCK.

But because there's no known waiting-for pid for a buffer pin wait, we
currently don't detect that we're blocked :(.


Now, it'd not be too hard to make pg_isolation_test_session_is_blocked
also report being blocked when we're waiting for a buffer pin (ignoring
interesting_pids), similar to the safe snapshot test.  However I'm
worried that that could lead to "false" reports of blocking? But maybe
that's a small enough risk because there's few unconditional cleanup
lock acquisitions?

Hacking such a wait condition test into
pg_isolation_test_session_is_blocked() successfully allows my test to
work for VACUUM.

Not yet sure about what a suitable way to test this for analyze would
be, unless we'd also accept VacuumDelay as a wait condition :(. I guess
one fairly easy way would be to include an expression index, and have
the expression index acquire an unavailable lock. Which'd allow to
switch to another session.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Implementing Incremental View Maintenance
Next
From: Amit Kapila
Date:
Subject: Re: Inconsistency in determining the timestamp of the db statfile.