Re: [PATCHES] TODO-item: Add sleep() function, remove from regress.c

2006-01-10 Thread Joachim Wieland
On Mon, Jan 09, 2006 at 08:50:36PM -0500, Tom Lane wrote: > pg_sleep seems like a better idea to me too. ok, renamed again. > Why is the function defined to take numeric rather than float8? > float8 is a whole lot easier to work with internally. ok, changed. > The proposed regression test seems

Re: [PATCHES] TODO-item: Add sleep() function, remove from regress.c

2006-01-10 Thread Tom Lane
Joachim Wieland <[EMAIL PROTECTED]> writes: > On Mon, Jan 09, 2006 at 08:50:36PM -0500, Tom Lane wrote: >> The proposed regression test seems unacceptably fragile, as well as >> rather pointless. > Why is it fragile? As your own comment pointed out, the test would "fail" on a heavily loaded syste

[PATCHES] TupleDesc refcounting

2006-01-10 Thread Neil Conway
Attached is a WIP patch that adds reference counting for TupleDescs. Two issues that I ran into while implementing it: (1) How should the lifetime of a TupleDesc be managed? The existing ResourceOwner stuff seems to assume that it is managing "per-query" resources. A TupleDesc will often live beyo

Re: [PATCHES] TupleDesc refcounting

2006-01-10 Thread Tom Lane
Neil Conway <[EMAIL PROTECTED]> writes: > (1) How should the lifetime of a TupleDesc be managed? The existing > ResourceOwner stuff seems to assume that it is managing "per-query" > resources. Yeah. I was envisioning two different approaches: for TupleDesc references from long-lived data structur

Re: [PATCHES] Summary table trigger example race condition

2006-01-10 Thread Jim C. Nasby
On Sun, Jan 08, 2006 at 04:13:01PM +1300, Mark Kirkwood wrote: > After re-examining the original code, it looks like it was not actually > vulnerable to a race condition! (it does the UPDATE, then if not found > will do an INSERT, and handle unique violation with a repeat of the same > UPDATE -

Re: [PATCHES] Summary table trigger example race condition

2006-01-10 Thread Mark Kirkwood
Jim C. Nasby wrote: On Sun, Jan 08, 2006 at 04:13:01PM +1300, Mark Kirkwood wrote: After re-examining the original code, it looks like it was not actually vulnerable to a race condition! (it does the UPDATE, then if not found will do an INSERT, and handle unique violation with a repeat of the

Re: [PATCHES] TODO-item: Add sleep() function, remove from regress.c

2006-01-10 Thread Jim C. Nasby
On Tue, Jan 10, 2006 at 11:31:13AM +0100, Joachim Wieland wrote: > No, cancelling the sleep works (at least for Unix). Isn't cancelling > implemented via a signal that interrupts select() ? > > Anyway, I've changed it, removing the ~2000s limit is a good point. > + while (secs > 1.0) > + {

Re: [PATCHES] TODO-item: Add sleep() function, remove from regress.c

2006-01-10 Thread Andrew Dunstan
Jim C. Nasby wrote: On Tue, Jan 10, 2006 at 11:31:13AM +0100, Joachim Wieland wrote: No, cancelling the sleep works (at least for Unix). Isn't cancelling implemented via a signal that interrupts select() ? Anyway, I've changed it, removing the ~2000s limit is a good point. + while (

Re: [PATCHES] Summary table trigger example race condition

2006-01-10 Thread Mark Kirkwood
Mark Kirkwood wrote: Jim C. Nasby wrote: On Sun, Jan 08, 2006 at 04:13:01PM +1300, Mark Kirkwood wrote: What happens if someone deletes the row between the failed insert and the second update? :) In this example the rows in the summary table never get deleted by DELETE operations on that

Re: [PATCHES] TODO-item: Add sleep() function, remove from regress.c

2006-01-10 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes: > Jim C. Nasby wrote: >> Won't this result in a call to pg_sleep with a long sleep time ending up >> sleeping noticeably longer than requested? > Looks like it to me. Something on the order of 1% longer, hm? (1 extra clock tick per second, probably.) C

Re: [PATCHES] TODO-item: Add sleep() function, remove from regress.c

2006-01-10 Thread Andrew Dunstan
Tom Lane said: > Andrew Dunstan <[EMAIL PROTECTED]> writes: >> Jim C. Nasby wrote: >>> Won't this result in a call to pg_sleep with a long sleep time ending >>> up sleeping noticeably longer than requested? > >> Looks like it to me. > > Something on the order of 1% longer, hm? (1 extra clock tick