From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Avoid consuming an XID during vac_truncate_clog(). |
Date: | 2016-05-24 19:20:49 |
Message-ID: | E1b5Hsn-0001n1-Jc@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Avoid consuming an XID during vac_truncate_clog().
vac_truncate_clog() uses its own transaction ID as the comparison point in
a sanity check that no database's datfrozenxid has already wrapped around
"into the future". That was probably fine when written, but in a lazy
vacuum we won't have assigned an XID, so calling GetCurrentTransactionId()
causes an XID to be assigned when otherwise one would not be. Most of the
time that's not a big problem ... but if we are hard up against the
wraparound limit, consuming XIDs during antiwraparound vacuums is a very
bad thing.
Instead, use ReadNewTransactionId(), which not only avoids this problem
but is in itself a better comparison point to test whether wraparound
has already occurred.
Report and patch by Alexander Korotkov. Back-patch to all versions.
Report: <CAPpHfdspOkmiQsxh-UZw2chM6dRMwXAJGEmmbmqYR=yvM7-s6A(at)mail(dot)gmail(dot)com>
Branch
------
REL9_2_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/2e7f0c34aa6dd2f4c02f57d9dd5c37eeeb661198
Modified Files
--------------
src/backend/commands/vacuum.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-05-24 19:48:18 | pgsql: Fetch XIDs atomically during vac_truncate_clog(). |
Previous Message | Alvaro Herrera | 2016-05-24 18:57:55 | pgsql: Fix range check for effective_io_concurrency |