pgsql: Ensure ANALYZE phase is not skipped because of canceled truncate - Mailing list pgsql-committers

From Kevin Grittner
Subject pgsql: Ensure ANALYZE phase is not skipped because of canceled truncate
Date
Msg-id E1UWsVT-0003x1-0e@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/2751c7f7395d169ccac053d104e86c3dd45594ca

Modified Files
--------------
src/backend/commands/vacuumlazy.c |   58 ++++++++++++++-----------------------
1 files changed, 22 insertions(+), 36 deletions(-)


pgsql-committers by date:

Previous
From: Kevin Grittner
Date:
Subject: pgsql: Ensure ANALYZE phase is not skipped because of canceled truncate
Next
From: Kevin Grittner
Date:
Subject: pgsql: Ensure ANALYZE phase is not skipped because of canceled truncate