diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2008-07-11 02:10:14 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2008-07-11 02:10:14 +0000 |
commit | 110147653aebe8eba9a42559e3737ac0d48d107f (patch) | |
tree | fa1ed0f6f69effad15b366709ffb84169f5fd85e /src/backend/utils/time/snapmgr.c | |
parent | 0c2914d4cb56923933b5a710d9ce84c275065594 (diff) | |
download | postgresql-110147653aebe8eba9a42559e3737ac0d48d107f.tar.gz postgresql-110147653aebe8eba9a42559e3737ac0d48d107f.zip |
Make sure we only try to free snapshots that have been passed through
CopySnapshot, per Neil Conway. Also add a comment about the assumption in
GetSnapshotData that the argument is statically allocated.
Also, fix some more typos in comments in snapmgr.c.
Diffstat (limited to 'src/backend/utils/time/snapmgr.c')
-rw-r--r-- | src/backend/utils/time/snapmgr.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index c0f6a97847e..841a92567d1 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -3,10 +3,9 @@ * PostgreSQL snapshot manager * * We keep track of snapshots in two ways: the "registered snapshots" list, - * and the "active snapshot" stack. All snapshots in any of them is supposed - * to be in persistent memory. When a snapshot is no longer in any of these - * lists (tracked by separate refcounts of each snapshot), its memory can be - * freed. + * and the "active snapshot" stack. All snapshots in either of them live in + * persistent memory. When a snapshot is no longer in any of these lists + * (tracked by separate refcounts on each snapshot), its memory can be freed. * * These arrangements let us reset MyProc->xmin when there are no snapshots * referenced by this transaction. (One possible improvement would be to be @@ -23,7 +22,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/time/snapmgr.c,v 1.3 2008/07/11 00:00:29 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/utils/time/snapmgr.c,v 1.4 2008/07/11 02:10:14 alvherre Exp $ * *------------------------------------------------------------------------- */ @@ -261,6 +260,7 @@ FreeSnapshot(Snapshot snapshot) { Assert(snapshot->regd_count == 0); Assert(snapshot->active_count == 0); + Assert(snapshot->copied); pfree(snapshot); } |