pgsql: Improve snapshot manager by keeping explicit track of snapshots.

Lists: pgsql-committers
From: alvherre(at)postgresql(dot)org (Alvaro Herrera)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve snapshot manager by keeping explicit track of snapshots.
Date: 2008-05-12 20:02:02
Message-ID: 20080512200202.D25FF7559EA@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/access/transam:
xact.c (r1.263 -> r1.264)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xact.c?r1=1.263&r2=1.264)
pgsql/src/backend/catalog:
index.c (r1.298 -> r1.299)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/index.c?r1=1.298&r2=1.299)
pgsql/src/backend/commands:
cluster.c (r1.175 -> r1.176)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/cluster.c?r1=1.175&r2=1.176)
copy.c (r1.298 -> r1.299)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/copy.c?r1=1.298&r2=1.299)
explain.c (r1.173 -> r1.174)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/explain.c?r1=1.173&r2=1.174)
indexcmds.c (r1.175 -> r1.176)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/indexcmds.c?r1=1.175&r2=1.176)
portalcmds.c (r1.73 -> r1.74)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/portalcmds.c?r1=1.73&r2=1.74)
prepare.c (r1.86 -> r1.87)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/prepare.c?r1=1.86&r2=1.87)
trigger.c (r1.232 -> r1.233)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/trigger.c?r1=1.232&r2=1.233)
vacuum.c (r1.372 -> r1.373)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/vacuum.c?r1=1.372&r2=1.373)
variable.c (r1.127 -> r1.128)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/variable.c?r1=1.127&r2=1.128)
pgsql/src/backend/executor:
execMain.c (r1.308 -> r1.309)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execMain.c?r1=1.308&r2=1.309)
functions.c (r1.124 -> r1.125)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/functions.c?r1=1.124&r2=1.125)
spi.c (r1.194 -> r1.195)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/spi.c?r1=1.194&r2=1.195)
pgsql/src/backend/storage/ipc:
procarray.c (r1.43 -> r1.44)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/ipc/procarray.c?r1=1.43&r2=1.44)
pgsql/src/backend/storage/large_object:
inv_api.c (r1.132 -> r1.133)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/large_object/inv_api.c?r1=1.132&r2=1.133)
pgsql/src/backend/tcop:
fastpath.c (r1.99 -> r1.100)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/fastpath.c?r1=1.99&r2=1.100)
postgres.c (r1.551 -> r1.552)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/postgres.c?r1=1.551&r2=1.552)
pquery.c (r1.122 -> r1.123)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/pquery.c?r1=1.122&r2=1.123)
pgsql/src/backend/utils/adt:
ri_triggers.c (r1.107 -> r1.108)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/ri_triggers.c?r1=1.107&r2=1.108)
txid.c (r1.6 -> r1.7)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/txid.c?r1=1.6&r2=1.7)
pgsql/src/backend/utils/cache:
plancache.c (r1.17 -> r1.18)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/plancache.c?r1=1.17&r2=1.18)
pgsql/src/backend/utils/time:
snapmgr.c (r1.1 -> r1.2)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/time/snapmgr.c?r1=1.1&r2=1.2)
pgsql/src/include/storage:
procarray.h (r1.21 -> r1.22)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/procarray.h?r1=1.21&r2=1.22)
pgsql/src/include/utils:
snapmgr.h (r1.1 -> r1.2)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/snapmgr.h?r1=1.1&r2=1.2)
snapshot.h (r1.2 -> r1.3)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/snapshot.h?r1=1.2&r2=1.3)
pgsql/src/pl/plpgsql/src:
pl_exec.c (r1.212 -> r1.213)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/pl/plpgsql/src/pl_exec.c?r1=1.212&r2=1.213)