mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +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:
@ -710,17 +710,18 @@ extern int _bt_pagedel(Relation rel, Buffer buf);
|
||||
*/
|
||||
extern BTStack _bt_search(Relation rel,
|
||||
int keysz, ScanKey scankey, bool nextkey,
|
||||
Buffer *bufP, int access);
|
||||
Buffer *bufP, int access, Snapshot snapshot);
|
||||
extern Buffer _bt_moveright(Relation rel, Buffer buf, int keysz,
|
||||
ScanKey scankey, bool nextkey, bool forupdate, BTStack stack,
|
||||
int access);
|
||||
int access, Snapshot snapshot);
|
||||
extern OffsetNumber _bt_binsrch(Relation rel, Buffer buf, int keysz,
|
||||
ScanKey scankey, bool nextkey);
|
||||
extern int32 _bt_compare(Relation rel, int keysz, ScanKey scankey,
|
||||
Page page, OffsetNumber offnum);
|
||||
extern bool _bt_first(IndexScanDesc scan, ScanDirection dir);
|
||||
extern bool _bt_next(IndexScanDesc scan, ScanDirection dir);
|
||||
extern Buffer _bt_get_endpoint(Relation rel, uint32 level, bool rightmost);
|
||||
extern Buffer _bt_get_endpoint(Relation rel, uint32 level, bool rightmost,
|
||||
Snapshot snapshot);
|
||||
|
||||
/*
|
||||
* prototypes for functions in nbtutils.c
|
||||
|
Reference in New Issue
Block a user