Re: BUG #14941: Vacuum crashes

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, 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-03-07 15:32:33
Message-ID: 3834EFB8-2A90-41C7-A7C8-8B956150479D@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 3/6/18, 11:04 PM, "Michael Paquier" <michael(at)paquier(dot)xyz> wrote:
> + if (!(options & VACOPT_SKIP_LOCKED))
> + relid = RangeVarGetRelid(vrel->relation, AccessShareLock,
> false);
> + else
> + {
> + relid = RangeVarGetRelid(vrel->relation, NoLock, false);
> Yeah, I agree with Andres that getting all this logic done in
> RangeVarGetRelidExtended would be cleaner. Let's see where the other
> thread leads us to:
> https://www.postgresql.org/message-id/20180306005349.b65whmvj7z6hbe2y%40alap3.anarazel.de

I had missed that thread. Thanks for pointing it out.

> + /*
> + * We must downcase the statement type for log message
> consistency
> + * between expand_vacuum_rel(), vacuum_rel(), and analyze_rel().
> + */
> + stmttype_lower = asc_tolower(stmttype, strlen(stmttype));
> This blows up on multi-byte characters and may report incorrect relation
> name if double quotes are used, no?

At the moment, stmttype is either "VACUUM" or "ANALYZE", but I suppose
there still might be multi-byte risk in translations.

> + /*
> + * Since autovacuum workers supply OIDs when calling vacuum(), no
> + * autovacuum worker should reach this code, and we can make
> + * assumptions about the logging levels we should use in the
> checks
> + * below.
> + */
> + Assert(!IsAutoVacuumWorkerProcess());
> This is a good idea, should be a separate patch as other folks tend to
> be confused with relid handling in expand_vacuum_rel().

Will do.

> + Specifies that <command>VACUUM</command> should not wait for any
> + conflicting locks to be released: if a relation cannot be locked
> + immediately without waiting, the relation is skipped
> Should this mention as well that no errors are raised, allowing the
> process to move on with the next relations?

IMO that is already covered by saying the relation is skipped,
although I'm not against explicitly stating it, too. Perhaps we could
outline the logging behavior as well.

Nathan

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2018-03-07 20:16:44 Re: BUG #15096: Unable to CREATE TABLE LIKE with bigint identity column
Previous Message Sergei Kornilov 2018-03-07 11:42:51 Re: BUG #15100: sequence behavior on failed insert to a partitioned table

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-03-07 15:38:43 Re: Limit global default function execution privileges
Previous Message David G. Johnston 2018-03-07 15:29:39 Limit global default function execution privileges