From 2cc41acd8fa3ebb8f0501c6102a253fb7053cf46 Mon Sep 17 00:00:00 2001 From: Kevin Grittner Date: Fri, 6 May 2016 07:47:12 -0500 Subject: Fix hash index vs "snapshot too old" problemms Hash indexes are not WAL-logged, and so do not maintain the LSN of index pages. Since the "snapshot too old" feature counts on detecting error conditions using the LSN of a table and all indexes on it, this makes it impossible to safely do early vacuuming on any table with a hash index, so add this to the tests for whether the xid used to vacuum a table can be adjusted based on old_snapshot_threshold. While at it, add a paragraph to the docs for old_snapshot_threshold which specifically mentions this and other aspects of the feature which may otherwise surprise users. Problem reported and patch reviewed by Amit Kapila --- src/backend/utils/time/snapmgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/time/snapmgr.c') diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index 0a9a231f597..e1551a3aeba 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -1590,7 +1590,8 @@ TransactionIdLimitedForOldSnapshots(TransactionId recentXmin, && old_snapshot_threshold >= 0 && RelationNeedsWAL(relation) && !IsCatalogRelation(relation) - && !RelationIsAccessibleInLogicalDecoding(relation)) + && !RelationIsAccessibleInLogicalDecoding(relation) + && !RelationHasUnloggedIndex(relation)) { int64 ts = GetSnapshotCurrentTimestamp(); TransactionId xlimit = recentXmin; -- cgit v1.2.3