pgsql: Add the "snapshot too old" feature - Mailing list pgsql-committers
From | Kevin Grittner |
---|---|
Subject | pgsql: Add the "snapshot too old" feature |
Date | |
Msg-id | E1aocLh-0006C7-2W@gemulon.postgresql.org Whole thread Raw |
Responses |
Re: pgsql: Add the "snapshot too old" feature
Re: pgsql: Add the "snapshot too old" feature Re: pgsql: Add the "snapshot too old" feature Re: pgsql: Add the "snapshot too old" feature |
List | pgsql-committers |
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. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/848ef42bb8c7909c9d7baa38178d4a209906e7c1 Modified Files -------------- contrib/bloom/blscan.c | 3 +- doc/src/sgml/config.sgml | 50 +++ src/backend/access/brin/brin.c | 19 +- src/backend/access/brin/brin_revmap.c | 11 +- src/backend/access/gin/ginbtree.c | 9 +- src/backend/access/gin/gindatapage.c | 7 +- src/backend/access/gin/ginget.c | 22 +- src/backend/access/gin/gininsert.c | 2 +- src/backend/access/gist/gistget.c | 2 +- src/backend/access/hash/hash.c | 3 +- src/backend/access/hash/hashsearch.c | 10 +- src/backend/access/heap/heapam.c | 31 +- src/backend/access/heap/pruneheap.c | 11 +- src/backend/access/nbtree/nbtinsert.c | 7 +- src/backend/access/nbtree/nbtpage.c | 2 +- src/backend/access/nbtree/nbtsearch.c | 51 ++- src/backend/access/spgist/spgscan.c | 2 +- src/backend/commands/vacuum.c | 3 +- src/backend/commands/vacuumlazy.c | 3 +- src/backend/storage/buffer/bufmgr.c | 40 ++ src/backend/storage/ipc/ipci.c | 3 + src/backend/storage/ipc/procarray.c | 9 + src/backend/storage/lmgr/lwlocknames.txt | 1 + src/backend/utils/errcodes.txt | 4 + src/backend/utils/misc/guc.c | 11 + src/backend/utils/misc/postgresql.conf.sample | 2 + src/backend/utils/time/snapmgr.c | 404 +++++++++++++++++++++ src/include/access/brin_revmap.h | 5 +- src/include/access/gin_private.h | 4 +- src/include/access/nbtree.h | 7 +- src/include/storage/bufmgr.h | 19 +- src/include/utils/rel.h | 1 + src/include/utils/snapmgr.h | 13 + src/include/utils/snapshot.h | 4 + src/test/modules/Makefile | 1 + src/test/modules/snapshot_too_old/Makefile | 47 +++ .../snapshot_too_old/expected/sto_using_cursor.out | 73 ++++ .../snapshot_too_old/expected/sto_using_select.out | 55 +++ .../snapshot_too_old/specs/sto_using_cursor.spec | 37 ++ .../snapshot_too_old/specs/sto_using_select.spec | 36 ++ src/test/modules/snapshot_too_old/sto.conf | 3 + 41 files changed, 942 insertions(+), 85 deletions(-)
pgsql-committers by date: