Re: BUG #14941: Vacuum crashes

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Lyes Ameddah <lyes(dot)amd(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14941: Vacuum crashes
Date: 2018-01-09 04:27:20
Message-ID: 20180109042720.GG76418@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Thu, Dec 28, 2017 at 10:46:18PM +0000, Bossart, Nathan wrote:
> I agree, this makes more sense. I've made this change in v3 of 0003.

Based on the opinions gathered on this thread, 0001 and 0002 seem to be
in the shape wanted, and those look good for shipping. Now for 0003 we
are not there yet.

- if (relation == NULL)
+ if (relation != NULL)
+ relname = relation->relname;
+ else if (!rel_lock)
+ relname = get_rel_name(relid);
+
+ if (relname == NULL)
I think that you are doing it wrong here. In get_all_vacuum_rels() you
should build a RangeVar to be reused in the context of this error
message, and hence you'll save an extra lookup based on the relation
OID here, saving from any timing issues that you have overseen as in
this code path a lock on the relation whose name is looked at is not
taken. Relying on the RangeVar being NULL to not generate any logs is
fine as a concept to me, but let's fill it where it is needed, and in
the case of this patch a VACUUM NOWAIT on the whole database is such a
case.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-01-09 05:37:35 Re: BUG #14983: ERROR: duplicate key value violates unique constraint "oid_tbl_oid_key"
Previous Message Thomas Kellerer 2018-01-08 21:16:57 Re: BUG #15000: Cache lookup failure

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2018-01-09 04:36:10 Re: [HACKERS] Proposal: Local indexes for partitioned table
Previous Message Amit Kapila 2018-01-09 04:05:30 Re: Parallel append plan instability/randomness