Skip site navigation (1) Skip section navigation (2)

pgsql: Fix longstanding problems in VACUUM caused by untimely

From: alvherre(at)postgresql(dot)org (Alvaro Herrera)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix longstanding problems in VACUUM caused by untimely
Date: 2009-11-10 18:00:44
Message-ID: 20091110180044.C2C08753FB7@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Fix longstanding problems in VACUUM caused by untimely interruptions

In VACUUM FULL, an interrupt after the initial transaction has been recorded
as committed can cause postmaster to restart with the following error message:
PANIC: cannot abort transaction NNNN, it was already committed
This problem has been reported many times.

In lazy VACUUM, an interrupt after the table has been truncated by
lazy_truncate_heap causes other backends' relcache to still point to the
removed pages; this can cause future INSERT and UPDATE queries to error out
with the following error message:
could not read block XX of relation 1663/NNN/MMMM: read only 0 of 8192 bytes
The window to this race condition is extremely narrow, but it has been seen in
the wild involving a cancelled autovacuum process.

The solution for both problems is to inhibit interrupts in both operations
until after the respective transactions have been committed.  It's not a
complete solution, because the transaction could theoretically be aborted by
some other error, but at least fixes the most common causes of both problems.

Tags:
----
REL8_3_STABLE

Modified Files:
--------------
    pgsql/src/backend/commands:
        vacuum.c (r1.364.2.2 -> r1.364.2.3)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuum.c?r1=1.364.2.2&r2=1.364.2.3)
        vacuumlazy.c (r1.103.2.2 -> r1.103.2.3)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuumlazy.c?r1=1.103.2.2&r2=1.103.2.3)
    pgsql/src/include/commands:
        vacuum.h (r1.75.2.1 -> r1.75.2.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/vacuum.h?r1=1.75.2.1&r2=1.75.2.2)

pgsql-committers by date

Next:From: Alvaro HerreraDate: 2009-11-10 18:00:57
Subject: pgsql: Fix longstanding problems in VACUUM caused by untimely
Previous:From: Alvaro HerreraDate: 2009-11-10 18:00:30
Subject: pgsql: Fix longstanding problems in VACUUM caused by untimely

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group