Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Patches > Re: Snapshot ma...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 11 Topic 3620 of 4084
Post > Topic >>

Re: Snapshot management, final

by alvherre@[EMAIL PROTECTED] (Alvaro Herrera) May 11, 2008 at 09:10 PM

Tom Lane wrote:
> Alvaro Herrera <alvherre@[EMAIL PROTECTED]
> writes:
> > Tom Lane wrote:
> >> Shouldn't UnregisterSnapshot insist that s_level be equal to current
> >> xact nest level?
> 
> > It can't check that; consider
> 
> > begin;
> > savepoint foo;
> > declare cur cursor for select (1), (2), (3);
> > savepoint bar;
> > close cur;
> > commit;
> 
> Hmm ... but that "close" can't unregister the snapshot immediately,
> because you'd lose if the 2nd savepoint gets rolled back, no?  Is the
> handling of this case even correct at the moment?

No, CLOSE is not rolled back:

alvherre=# begin;
BEGIN
alvherre=# savepoint foo;
SAVEPOINT
alvherre=# declare cur cursor for select (1), (2), (3);
DECLARE CURSOR
alvherre=# savepoint bar;
SAVEPOINT
alvherre=# close cur;
CLOSE CURSOR
alvherre=# rollback to bar;
ROLLBACK
alvherre=# fetch all from cur;
ERREUR:  le curseur « cur » n'existe pas

Maybe this is possible to fix, but again I think it's outside the scope
of this patch.

> ISTM correct handling of this example would require that the "close"
> not really discard the snap until commit.  Then, given proper ordering
> of the cleanup operations at commit, you might be able to still have the
> cross-check about s_level in UnregisterSnapshot.  (IOW, maybe having
> snapshot cleanup be late in the commit sequence wasn't such a good
> choice...)

Right -- I'll move them earlier.  I don't think it's trivial to fix the
un-rollback-ability of CLOSE however.

-- 
Alvaro Herrera                               
http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 sup****t

-- 
Sent via pgsql-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
 




 11 Posts in Topic:
Re: Snapshot management, final
simon@[EMAIL PROTECTED]   2008-04-22 22:45:12 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-04-22 17:50:56 
Re: Snapshot management, final
tgl@[EMAIL PROTECTED] (T  2008-05-06 17:26:34 
Re: Snapshot management, final
tgl@[EMAIL PROTECTED] (T  2008-05-06 17:59:11 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-05-07 14:48:11 
Re: Snapshot management, final
tgl@[EMAIL PROTECTED] (T  2008-05-11 19:10:23 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-05-11 20:55:38 
Re: Snapshot management, final
tgl@[EMAIL PROTECTED] (T  2008-05-11 21:03:25 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-05-11 21:10:16 
Re: Snapshot management, final
tgl@[EMAIL PROTECTED] (T  2008-05-11 21:16:33 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-05-12 16:07:35 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 6:07:28 CDT 2008.