OSDN Git Service

Fix snapshot management, take two.
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 7 Oct 2009 16:27:18 +0000 (16:27 +0000)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 7 Oct 2009 16:27:18 +0000 (16:27 +0000)
commit07cefdfb7a1c1a7ae96783c9723102250a4c3bad
tree3b1838727a0455e08833a930ed4d0cd31d1fc2e4
parent603e72b0bea008edba86f8d366b675992e0bcf90
Fix snapshot management, take two.

Partially revert the previous patch I installed and replace it with a more
general fix: any time a snapshot is pushed as Active, we need to ensure that it
will not be modified in the future.  This means that if the same snapshot is
used as CurrentSnapshot, it needs to be copied separately.  This affects
serializable transactions only, because CurrentSnapshot has already been copied
by RegisterSnapshot and so PushActiveSnapshot does not think it needs another
copy.  However, CommandCounterIncrement would modify CurrentSnapshot, whereas
ActiveSnapshots must not have their command counters incremented.

I say "partially" because the regression test I added for the previous bug
has been kept.

(This restores 8.3 behavior, because before snapmgr.c existed, any snapshot set
as Active was copied.)

Per bug report from Stuart Bishop in
6bc73d4c0910042358k3d1adff3qa36f8df75198ecea@mail.gmail.com
src/backend/commands/portalcmds.c
src/backend/utils/time/snapmgr.c
src/include/utils/snapmgr.h
src/test/regress/expected/triggers.out
src/test/regress/sql/triggers.sql