Re: Removing cruft in access/transam/xact.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Removing cruft in access/transam/xact.c
Date: 2004-03-27 05:21:07
Message-ID: 2213.1080364867@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> writes:
> This patch removes the unnecesary TRANS_* states that supposedly
> represented "low level transaction state". The state is actually
> unnecesary because the states can be accurately represented using the
> TBLOCK_* states.

Really?

Your changes to StartTransaction() are alone enough to refute the above
claim. With these changes, there is no longer any state in xact.c that
can detect a failure during transaction startup.

The similar changes that remove the ability to recognize failures
during AbortTransaction are even worse, because cleanup after a failed
transaction is exactly where you would most expect software bugs to
pop up.

We could talk about a different solution to detecting such failures
(maybe it's okay to convert the whole thing into a critical section)
but simply removing all hope of detecting a failure won't do.

The comments in xact.c make it perfectly clear that it took several
tries for the Berkeley crew to get this code right. I'm not eager
to simplify it on the basis of one person's unsupported assertion
that the complexity is unnecessary. If you can prove it's unnecessary,
let's see the proof.

> This passes the full regression test suite.

The regression test suite does not cover "can't-happen" cases ...

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Serguei Mokhov 2004-03-27 17:59:58 Translation Updates for 7.4.x: pg_dump-ru.po.gz;psql-ru.po.gz
Previous Message Claudio Natoli 2004-03-27 05:01:21 Re: APC/socket fix (final?)