Re: nested xacts and phantom Xids

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Subject: Re: nested xacts and phantom Xids
Date: 2004-06-20 21:30:37
Message-ID: 200406202130.i5KLUb305895@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian wrote:
> Tom Lane wrote:
> > Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-06-20 21:34:41 Re: nested xacts and phantom Xids
Previous Message Gavin Sherry 2004-06-20 21:29:07 Re: Tablespaces

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-06-20 21:34:41 Re: nested xacts and phantom Xids
Previous Message Gavin Sherry 2004-06-20 21:29:07 Re: Tablespaces