Re: BUG #8954: Wrong text in database log during "truncate scan"

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: maxim(dot)boguk(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8954: Wrong text in database log during "truncate scan"
Date: 2014-01-24 14:29:00
Message-ID: 20140124142900.GZ10723@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

maxim(dot)boguk(at)gmail(dot)com escribió:

> If manual vacuum performed in the table and could not required lock for
> truncate scan it wrote a bit misleading error message:
>
> 2014-01-24 16:19:11 MSK 7134 cron(dot)app(at)*** from [local] [vxid:297/14422865
> txid:2179070646] [VACUUM] LOG: automatic vacuum of table
> "hh_data.public.vacancy_response": could not (re)acquire exclusive lock for
> truncate scan

This was fixed by this commit:

Author: Kevin Grittner <kgrittn(at)postgresql(dot)org>
Branch: master Release: REL9_3_BR [5fc893760] 2013-04-29 13:05:26 -0500
Branch: REL9_2_STABLE Release: REL9_2_5 [95909f3be] 2013-04-29 13:05:56 -0500
Branch: REL9_1_STABLE Release: REL9_1_10 [93641341f] 2013-04-29 13:06:28 -0500
Branch: REL9_0_STABLE Release: REL9_0_14 [2751c7f73] 2013-04-29 13:06:49 -0500

Ensure ANALYZE phase is not skipped because of canceled truncate.

Patch b19e4250b45e91c9cbdd18d35ea6391ab5961c8d attempted to
preserve existing behavior regarding statistics generation in the
case that a truncation attempt was canceled due to lock conflicts.
It failed to do this accurately in two regards: (1) autovacuum had
previously generated statistics if the truncate attempt failed to
initially get the lock rather than having started the attempt, and
(2) the VACUUM ANALYZE command had always generated statistics.

Both of these changes were unintended, and are reverted by this
patch. On review, there seems to be consensus that the previous
failure to generate statistics when the truncate was terminated
was more an unfortunate consequence of how that effort was
previously terminated than a feature we want to keep; so this
patch generates statistics even when an autovacuum truncation
attempt terminates early. Another unintended change which is kept
on the basis that it is an improvement is that when a VACUUM
command is truncating, it will the new heuristic for avoiding
blocking other processes, rather than keeping an
AccessExclusiveLock on the table for however long the truncation
takes.

Per multiple reports, with some renaming per patch by Jeff Janes.

Backpatch to 9.0, where problem was created.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-01-24 15:14:24 Re: Re: PostgreSQL 6.2.5 Visual Studio Build does not pass the regression tests.
Previous Message maxim.boguk 2014-01-24 12:37:17 BUG #8954: Wrong text in database log during "truncate scan"