Improve snapshot manager by keeping explicit track of snapshots.
authorAlvaro Herrera
Mon, 12 May 2008 20:02:02 +0000 (20:02 +0000)
committerAlvaro Herrera
Mon, 12 May 2008 20:02:02 +0000 (20:02 +0000)
commit5da9da71c44f27ba48fdad08ef263bf70e43e689
treed8afb52acd9386a59c1862a265d4f8e6d2fdbaba
parentaa82790fcab98b8d3d4eca2e2f6f7bfce57870bc
Improve snapshot manager by keeping explicit track of snapshots.

There are two ways to track a snapshot: there's the "registered" list, which
is used for arbitrary long-lived snapshots; and there's the "active stack",
which is used for the snapshot that is considered "active" at any time.
This also allows users of snapshots to stop worrying about snapshot memory
allocation and freeing, and about using PG_TRY blocks around ActiveSnapshot
assignment.  This is all done automatically now.

As a consequence, this allows us to reset MyProc->xmin when there are no
more snapshots registered in the current backend, reducing the impact that
long-running transactions have on VACUUM.
27 files changed:
src/backend/access/transam/xact.c
src/backend/catalog/index.c
src/backend/commands/cluster.c
src/backend/commands/copy.c
src/backend/commands/explain.c
src/backend/commands/indexcmds.c
src/backend/commands/portalcmds.c
src/backend/commands/prepare.c
src/backend/commands/trigger.c
src/backend/commands/vacuum.c
src/backend/commands/variable.c
src/backend/executor/execMain.c
src/backend/executor/functions.c
src/backend/executor/spi.c
src/backend/storage/ipc/procarray.c
src/backend/storage/large_object/inv_api.c
src/backend/tcop/fastpath.c
src/backend/tcop/postgres.c
src/backend/tcop/pquery.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/txid.c
src/backend/utils/cache/plancache.c
src/backend/utils/time/snapmgr.c
src/include/storage/procarray.h
src/include/utils/snapmgr.h
src/include/utils/snapshot.h
src/pl/plpgsql/src/pl_exec.c