Bruce Momjian wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> > > Here I present the nested transactions patch and the phantom Xids patch
> > > that goes with it.
> >
> > I looked at the phantom XIDs stuff a bit. I still have little confidence
> > that the concept is correct :-( but here are some comments on the code
> > level.
> >
> > > + * They are marked immediately in pg_subtrans as direct childs of the topmost
> > > + * Xid (no matter how deep we are in the transaction tree),
> >
> > Why is that a good idea --- won't it cause problems when you
> > commit/abort an intermediate level of subtransaction?
>
> I don't think so. The phantom xid is used only by the outside
> transaction waiting for that tuple to be committe or aborted. The
> outside tranaction will sleep on the topmost xid completing, then check
> the phantom xid status for commit/abort. Within the transaction, I think
> he uses command counter to know the creation and destruction sub-xid.
>
> I think right now phantom xids are used only for making parts of a
> subtransaction committed or aborted and only in cases where the tuple is
> created and destroyed by parts of the same transaction tree.
>
> I don't feel too bad about the runtime cost if only subtransactions are
> paying that cost. I know we are really stretching the system here but I
> would like to try a little more rather than give up and taking a space
> hit for all tuples.
Let me add that outside transactions read those phantom xid only when
they are doing dirty reads. What I don't understand is when do outside
transactions see tuples created inside a transaction? INSERT into a
table with a unique key?
Once the main transaction commits, these phantom tuples should work just
like ordinary tuples except they get their cmin overwritten when they
are expired, I think.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073