]> granicus.if.org Git - postgresql/commit
Add the "snapshot too old" feature
authorKevin Grittner <kgrittn@postgresql.org>
Fri, 8 Apr 2016 19:36:30 +0000 (14:36 -0500)
committerKevin Grittner <kgrittn@postgresql.org>
Fri, 8 Apr 2016 19:36:30 +0000 (14:36 -0500)
commit848ef42bb8c7909c9d7baa38178d4a209906e7c1
treee15250d8dfd8f46b15e3ecfddfcad09799cc3866
parent8b65cf4c5edabdcae45ceaef7b9ac236879aae50
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.
41 files changed:
contrib/bloom/blscan.c
doc/src/sgml/config.sgml
src/backend/access/brin/brin.c
src/backend/access/brin/brin_revmap.c
src/backend/access/gin/ginbtree.c
src/backend/access/gin/gindatapage.c
src/backend/access/gin/ginget.c
src/backend/access/gin/gininsert.c
src/backend/access/gist/gistget.c
src/backend/access/hash/hash.c
src/backend/access/hash/hashsearch.c
src/backend/access/heap/heapam.c
src/backend/access/heap/pruneheap.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/spgist/spgscan.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/procarray.c
src/backend/storage/lmgr/lwlocknames.txt
src/backend/utils/errcodes.txt
src/backend/utils/misc/guc.c
src/backend/utils/misc/postgresql.conf.sample
src/backend/utils/time/snapmgr.c
src/include/access/brin_revmap.h
src/include/access/gin_private.h
src/include/access/nbtree.h
src/include/storage/bufmgr.h
src/include/utils/rel.h
src/include/utils/snapmgr.h
src/include/utils/snapshot.h
src/test/modules/Makefile
src/test/modules/snapshot_too_old/Makefile [new file with mode: 0644]
src/test/modules/snapshot_too_old/expected/sto_using_cursor.out [new file with mode: 0644]
src/test/modules/snapshot_too_old/expected/sto_using_select.out [new file with mode: 0644]
src/test/modules/snapshot_too_old/specs/sto_using_cursor.spec [new file with mode: 0644]
src/test/modules/snapshot_too_old/specs/sto_using_select.spec [new file with mode: 0644]
src/test/modules/snapshot_too_old/sto.conf [new file with mode: 0644]