Document that vacuum can't truncate if old_snapshot_threshold >= 0 - Mailing list pgsql-hackers

From Andres Freund
Subject Document that vacuum can't truncate if old_snapshot_threshold >= 0
Date
Msg-id 20160713211406.cf6yjq6577ici7mc@alap3.anarazel.de
Whole thread Raw
Responses Re: Document that vacuum can't truncate if old_snapshot_threshold >= 0  (Noah Misch <noah@leadboat.com>)
Re: Document that vacuum can't truncate if old_snapshot_threshold >= 0  (Kevin Grittner <kgrittn@gmail.com>)
List pgsql-hackers
Hi,

Currently, if old_snapshot_threshold is enabled, vacuum is prevented
from truncating tables:
static bool
should_attempt_truncation(LVRelStats *vacrelstats)
{BlockNumber possibly_freeable;
possibly_freeable = vacrelstats->rel_pages - vacrelstats->nonempty_pages;if (possibly_freeable > 0 &&
(possibly_freeable>= REL_TRUNCATE_MINIMUM ||  possibly_freeable >= vacrelstats->rel_pages / REL_TRUNCATE_FRACTION) &&
old_snapshot_threshold < 0)    return true;else    return false;
 
}

(note the old_snapshot_threshold < 0 condition).

That appears to not be mentioned in a comment, the commit message or the
the docs. I think this definitely needs to be prominently documented.

FWIW, afaics that's required because new pages don't have an LSN, so we
can't necessarily detect that a truncated and re-extended relation,
wouldn't be valid. Although I do wonder if there isn't a less invasive
way to do that.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <
Next
From: Fabien COELHO
Date:
Subject: Re: pgbench - allow to store select results into variables