Re: timeout implementation issues

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Thomas Lockhart <lockhart(at)fourpalms(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jessica Perry Hekman <jphekman(at)dynamicdiagrams(dot)com>, Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Jan Wieck <janwieck(at)yahoo(dot)com>, Barry Lind <barry(at)xythos(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: timeout implementation issues
Date: 2002-04-08 16:27:32
Message-ID: 200204081627.g38GRW617971@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut wrote:
> Bruce Momjian writes:
>
> > OK, probably good time for summarization. First, consider this:
> >
> > BEGIN WORK;
> > SET something;
> > query fails;
> > SET something else;
> > COMMIT WORK;
> >
> > Under current behavior, the first SET is honored, while the second is
> > ignored because the transaction is in ABORT state. I can see no logical
> > reason for this behavior.
>
> But that is not a shortcoming of the SET command. The problem is that the
> system does not accept any commands after one command has failed in a
> transaction even though it could usefully do so.

Uh, yes, we could allow the second SET to succeed even in an aborted
transaction, but Tom says his schema stuff will not work in an aborted
state, so Tom/I figured the only other option was rollback of the first
SET.

> > The jdbc timeout issue is this:
> >
> >
> > BEGIN WORK;
> > SET query_timeout=20;
> > query fails;
> > SET query_timeout=0;
> > COMMIT WORK;
> >
> > In this case, with our current code, the first SET is done, but the
> > second is ignored.
>
> Given appropriate functionality, you could rewrite this thus:
>
> BEGIN WORK;
> SET FOR THIS TRANSACTION ONLY query_timeout=20;
> query;
> COMMIT WORK;

Yes, but why bother with that when rollback of the first SET is cleaner
and more predictable?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2002-04-08 16:28:18 Re: timeout implementation issues
Previous Message Fernando Nasser 2002-04-08 16:09:21 Re: What's the CURRENT schema ?