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 4 of 5 Topic 3621 of 4088
Post > Topic >>

Re: Snapshot management, final

by alvherre@[EMAIL PROTECTED] (Alvaro Herrera) Apr 22, 2008 at 09:15 PM

Tom Lane wrote:
> Alvaro Herrera <alvherre@[EMAIL PROTECTED]
> writes:
> 
> > CopySnapshot always copies snapshots to SnapshotContext, which is a
> > context that lives until transaction end.  There's no mechanism for
> > copying a snapshot into another context, because I don't see the need.
> 
> The only reason we have memory contexts at all is to avoid the need to
> track individual palloc'd objects.  Since we're instituting exactly such
> tracking for snapshots, there's no value in placing them in
> general-purpose memory contexts.

The problem is that we reuse snapshots, and not all uses have the same
longevity.  If a context goes away from under a snapshot and there are
other references to it, the result is a dangling pointer somewhere.
That's why we have reference counts on snaps: we know we can free one
when its refcounts are zero.  At the same time, the snapshots all go
away at transaction end with TopTransactionContext.

The other possible approach to this problem is creating a separate copy
each time a snapshot is reused, but this just causes extra palloc'ing
for no gain at all.

-- 
Alvaro Herrera                               
http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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




 5 Posts in Topic:
Re: Snapshot management, final
simon@[EMAIL PROTECTED]   2008-04-22 22:58:38 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-04-22 18:13:00 
Re: Snapshot management, final
tgl@[EMAIL PROTECTED] (T  2008-04-22 19:30:46 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-04-22 21:15:49 
Re: Snapshot management, final
alvherre@[EMAIL PROTECTED  2008-04-23 08:24:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sun Oct 12 14:37:26 CDT 2008.