Re: Add SKIP LOCKED to VACUUM and ANALYZE

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Lyes Ameddah <lyes(dot)amd(at)gmail(dot)com>
Subject: Re: Add SKIP LOCKED to VACUUM and ANALYZE
Date: 2018-07-25 01:06:32
Message-ID: 20180725010632.GA6660@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 24, 2018 at 05:21:25PM +0000, Bossart, Nathan wrote:
> Here is a patch for refactoring the ereport() calls out of
> vacuum_rel() and analyze_rel(). I've kept all four possible log
> statements separated for ease of translation. I considered
> simplifying these statements by replacing "vacuum" and "analyze" with
> "processing." However, that seems like it could lead to ambiguity for
> commands like "VACUUM (ANALYZE, SKIP_LOCKED) table1 (a);" since both
> VACUUM and ANALYZE could be skipped independently. If we add
> SKIP_LOCKED to CLUSTER in the future, we will need to add two more log
> statements to this function.

+typedef enum SkippedRelStmtType
+{
+ SRS_VACUUM,
+ SRS_ANALYZE
+} SkippedRelStmtType;
Hm... I have not imagined this part but adding a new layer is sort of
ugly, and an extra one would be needed for CLUSTER as well, in which
case adding cluster-related logs into vacuum.c introduces a circular
dependency with cluster.c. What about just skipping this refactoring
and move to the point where CLUSTER also gains its log queries directly
in cluster_rel? VACUUM FULL is also not going to run for autovacuum, so
that's less confusion with IsAutoVacuumWorkerProcess().

Another thing is the set of issues discussed in
https://www.postgresql.org/message-id/20180724041403.GF4035%40paquier.xyz
which are actually going to touch the same code areas that we are going
to change here, for actually rather similar purposes related to lock
handling. My gut feeling is to get the other issue fixed first, and
then rework this patch series so as we get the behavior that we want in
both the case of the previous thread and what we want here when building
a list of relations to VACUUM. There is as well the issue where a user
does not provide a list, so that's an extra argument for fixing the
current relid fetching properly first.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-07-25 02:49:56 Re: LLVM jit and matview
Previous Message Andres Freund 2018-07-25 00:27:42 Re: Early WIP/PoC for inlining CTEs