Обсуждение: Re: [JDBC] implementing query timeout

Поиск
Список
Период
Сортировка

Re: [JDBC] implementing query timeout

От
Bruce Momjian
Дата:
Jessica Perry Hekman wrote:
> As has been noted on this list before, query timeouts are not implemented
> in pgsql-jdbc (see
>
>   http://archives.postgresql.org/pgsql-bugs/2000-12/msg00093.php
>
> ). This is currently causing a problem for me, and I might (no
> promises) be interested in implementing it. So I'm testing the waters. If
> I did submit a patch for this, would the developers here be interested?

[ Hackers list added.]

You bet, but it would be done in the backend, not in jdbc.  Is that OK?

I have some ideas that should make it pretty easy.  If you set an
alarm() in the backend on transaction start, then call the query
cancel() code if the alarm() goes off, that should do it.  Of course,
you reset the alarm if the query finishes before the timeout.


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

Re: [JDBC] implementing query timeout

От
Jessica Perry Hekman
Дата:
On Wed, 13 Mar 2002, Bruce Momjian wrote:

> You bet, but it would be done in the backend, not in jdbc.  Is that OK?

Theoretically this is okay. I am more comfortable in Java than in C and I
hadn't looked at the backend code at all, but I'll take a peek and see if
it looks like something I'd feel comfortable doing.

> I have some ideas that should make it pretty easy.  If you set an
> alarm() in the backend on transaction start, then call the query
> cancel() code if the alarm() goes off, that should do it.  Of course,
> you reset the alarm if the query finishes before the timeout.

Sounds straightforward enough. Hopefully I'll get a chance to look at this
before the end of this week.

Thanks!

Jessica