diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-06-27 14:43:52 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-06-27 14:43:52 -0400 |
commit | 56f86bb764bb99a32810c52976926f85cc3bf3b1 (patch) | |
tree | 2ad0544ec3849fd96aa442df7fcc10eca016d9f4 /src/include/access/multixact.h | |
parent | 9eecc8a7cafa2be356a859f74c5db5961e190579 (diff) |
Have multixact be truncated by checkpoint, not vacuum
Instead of truncating pg_multixact at vacuum time, do it only at
checkpoint time. The reason for doing it this way is twofold: first, we
want it to delete only segments that we're certain will not be required
if there's a crash immediately after the removal; and second, we want to
do it relatively often so that older files are not left behind if
there's an untimely crash.
Per my proposal in
http://www.postgresql.org/message-id/20140626044519.GJ7340@eldon.alvh.no-ip.org
we now execute the truncation in the checkpointer process rather than as
part of vacuum. Vacuum is in only charge of maintaining in shared
memory the value to which it's possible to truncate the files; that
value is stored as part of checkpoints also, and so upon recovery we can
reuse the same value to re-execute truncate and reset the
oldest-value-still-safe-to-use to one known to remain after truncation.
Per bug reported by Jeff Janes in the course of his tests involving
bug #8673.
While at it, update some comments that hadn't been updated since
multixacts were changed.
Backpatch to 9.3, where persistency of pg_multixact files was
introduced by commit 0ac5ad5134f2.
Diffstat (limited to 'src/include/access/multixact.h')
-rw-r--r-- | src/include/access/multixact.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/access/multixact.h b/src/include/access/multixact.h index 80c70748cf2..0598c3328fc 100644 --- a/src/include/access/multixact.h +++ b/src/include/access/multixact.h @@ -119,12 +119,13 @@ extern void MultiXactGetCheckptMulti(bool is_shutdown, Oid *oldestMultiDB); extern void CheckPointMultiXact(void); extern MultiXactId GetOldestMultiXactId(void); -extern void TruncateMultiXact(MultiXactId cutoff_multi); +extern void TruncateMultiXact(void); extern void MultiXactSetNextMXact(MultiXactId nextMulti, MultiXactOffset nextMultiOffset); extern void MultiXactAdvanceNextMXact(MultiXactId minMulti, MultiXactOffset minMultiOffset); extern void MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB); +extern void MultiXactSetSafeTruncate(MultiXactId safeTruncateMulti); extern void multixact_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len); |