Обсуждение: pgsql: Avoid consuming an XID during vac_truncate_clog().

Поиск
Список
Период
Сортировка

pgsql: Avoid consuming an XID during vac_truncate_clog().

От
Tom Lane
Дата:
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@mail.gmail.com>

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/defe936ef81d6f785a895ec5b35d480b24cf29fe

Modified Files
--------------
src/backend/commands/vacuum.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)