mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Add the "snapshot too old" feature
This feature is controlled by a new old_snapshot_threshold GUC. A value of -1 disables the feature, and that is the default. The value of 0 is just intended for testing. Above that it is the number of minutes a snapshot can reach before pruning and vacuum are allowed to remove dead tuples which the snapshot would otherwise protect. The xmin associated with a transaction ID does still protect dead tuples. A connection which is using an "old" snapshot does not get an error unless it accesses a page modified recently enough that it might not be able to produce accurate results. This is similar to the Oracle feature, and we use the same SQLSTATE and error message for compatibility.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#define SNAPSHOT_H
|
||||
|
||||
#include "access/htup.h"
|
||||
#include "access/xlogdefs.h"
|
||||
#include "lib/pairingheap.h"
|
||||
#include "storage/buf.h"
|
||||
|
||||
@@ -105,6 +106,9 @@ typedef struct SnapshotData
|
||||
uint32 active_count; /* refcount on ActiveSnapshot stack */
|
||||
uint32 regd_count; /* refcount on RegisteredSnapshots */
|
||||
pairingheap_node ph_node; /* link in the RegisteredSnapshots heap */
|
||||
|
||||
int64 whenTaken; /* timestamp when snapshot was taken */
|
||||
XLogRecPtr lsn; /* position in the WAL stream when taken */
|
||||
} SnapshotData;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user