Thread: [subxacts] Last try before beta

[subxacts] Last try before beta

From
Alvaro Herrera
Date:
Hackers,

Here is the last patch before beta for subtransactions.  It fixes the
following outstanding issues:

- Add (some) user savepoint documentation
- Update comments in code, htup.h and xact.c
- EOXactCallback API extension (called on subxact start, abort, commit,
  and main xact abort and commit, with an "event" parameter and the
  parent transaction ID where appropiate)
- use lfirst_xid and lappend_xid (macros over lfirst_int and
  lappend_int)
- Xid cache speeds up TransactionIdIsInProgress
- IsSubTransaction uses nesting depth rather that TBLOCK status
- Ordering of operations on subxact start/abort/commit matches
  corresponding main xact operations
- SetReindexProcessing


Note that I deliberately broke the API for EOXactCallbacks, because
something that needs to do something at that low a level surely needs to
be at least revised to check if it's OK regarding subtransactions.

(I found no documentation for that API anyway?)

Please review and apply if OK.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"The eagle never lost so much time, as
when he submitted to learn of the crow." (William Blake)

Attachment

Re: [subxacts] Last try before beta

From
Tom Lane
Date:
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> Here is the last patch before beta for subtransactions.  It fixes the
> following outstanding issues:

> - Add (some) user savepoint documentation

The patch seems to intend to add three reference-page sgml files,
but those files are missing?

            regards, tom lane

Re: [subxacts] Last try before beta

From
Alvaro Herrera Munoz
Date:
On Sat, Jul 31, 2004 at 09:50:07PM -0400, Tom Lane wrote:
> Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> > Here is the last patch before beta for subtransactions.  It fixes the
> > following outstanding issues:
>
> > - Add (some) user savepoint documentation
>
> The patch seems to intend to add three reference-page sgml files,
> but those files are missing?

No, the files are embedded in the patch ...  I avoided using cvs diff
to create the patch -- rather I diff'd two source trees, which includes
the new files inline.

Applying with patch 2.5.9 creates the files here ...

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"La experiencia nos dice que el hombre peló millones de veces las patatas,
pero era forzoso admitir la posibilidad de que en un caso entre millones,
las patatas pelarían al hombre" (Ijon Tichy)

Re: [subxacts] Last try before beta

From
Tom Lane
Date:
Alvaro Herrera Munoz <alvherre@dcc.uchile.cl> writes:
>> The patch seems to intend to add three reference-page sgml files,
>> but those files are missing?

> No, the files are embedded in the patch ...  I avoided using cvs diff
> to create the patch -- rather I diff'd two source trees, which includes
> the new files inline.

Ah, got it.  Thanx.

I think the locking is still a few bricks shy of a load ... working
on it now ...

            regards, tom lane

Re: [subxacts] Last try before beta

From
Tom Lane
Date:
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> Here is the last patch before beta for subtransactions.  It fixes the
> following outstanding issues:

Applied with revisions.  I had to whack around the code associated with
the subtrans XID cache, because it was seriously violating the locking
requirements for addition/removal of running XIDs in PGPROC (see the
comments in GetSnapshotData, GetNewTransactionId, CommitTransaction).
It's possible that for subxact XIDs we need not be quite so tense, but
I would rather be conservative now and consider optimizations later.

> - Update comments in code, htup.h and xact.c

The "update" in xact.c seemed to consist of wholesale removal of the top
comment.  I didn't apply it, because the comment didn't seem that
useless.  It does need editorial work, but it's not content-free...

> - SetReindexProcessing

On this it seemed better to make use of TRY/CATCH to reset the flag
instead of putting the burden on xact.c.  Now that we have TRY/CATCH
I think we should make an effort to do things that way where possible.

> Note that I deliberately broke the API for EOXactCallbacks, because
> something that needs to do something at that low a level surely needs to
> be at least revised to check if it's OK regarding subtransactions.

Agreed.

            regards, tom lane

Re: [subxacts] Last try before beta

From
Alvaro Herrera
Date:
On Sun, Aug 01, 2004 at 01:41:39PM -0400, Tom Lane wrote:

> > - Update comments in code, htup.h and xact.c
>
> The "update" in xact.c seemed to consist of wholesale removal of the top
> comment.  I didn't apply it, because the comment didn't seem that
> useless.  It does need editorial work, but it's not content-free...

Well, the README file integrated those comments as appropiate.

Apparently the embed-new-files-in-patch business was not a good idea
after all.  Sorry for not being clear on the message.

Again, thanks for all your excellent work on this.

Oh, I was wondering whether it would be a good idea to move tqual.c
to access/transam.  I think it's weird in utils/time, and do we really
want a directory for just one file that's even badly placed according
to the comments on the file itself?

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"Y eso te lo doy firmado con mis lágrimas" (Fiebre del Loco)

Re: [subxacts] Last try before beta

From
Tom Lane
Date:
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> Well, the README file integrated those comments as appropiate.

Oh...

> Apparently the embed-new-files-in-patch business was not a good idea
> after all.  Sorry for not being clear on the message.

Yeah.  I can deal with 'cvs diff' stuff but it wasn't at all clear that
this patch was adding files.  Could you send me just the README (off
list)?

> Oh, I was wondering whether it would be a good idea to move tqual.c
> to access/transam.  I think it's weird in utils/time, and do we really
> want a directory for just one file that's even badly placed according
> to the comments on the file itself?

It's not worth the loss of CVS history to move it ... and I'm not sure
that access/transam is a better place anyway.

            regards, tom lane