mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user