Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c

From: Denis A Ustimenko <denis(at)oldham(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date: 2002-10-15 03:30:01
Message-ID: 20021015033001.GA1438@denis.oldham.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom, excuse me, I forget to copy previous posting to pgsql-hackers(at)postgresql(dot)org(dot)

On Mon, Oct 14, 2002 at 09:53:27AM -0400, Tom Lane wrote:
> Denis A Ustimenko <denis(at)oldham(dot)ru> writes:
> > On Sun, Oct 13, 2002 at 10:59:40PM -0700, Joe Conway wrote:
> >> Well, if we were specifying the timeout in microseconds instead of seconds,
> >> it would make sense to have better resolution. But when you can only
> >> specify the timeout in seconds, the internal time comparison doesn't need
> >> to be any more accurate than seconds (IMHO anyway).
>
> > Actually we have the state machine in connectDBComplete() and the timeout is
> > set for machine as the whole. Therefore if 1 second timeout is seted for the
> > connectDBComplete() the timeout of particualr iteration of loop can be less
> > then 1 second.
>
> However, the code's been restructured so that we don't need to keep
> track of the exact time spent in any one iteration. The error is only
> on the overall delay. I agree with Joe that it's not worth the effort
> needed (in the Win32 case) to make the timeout accurate to < 1 sec.
>

Beware of almost 1 second posiible error. For example: connect_timeout == 1,
we start at 0.999999 then finish_time == 1. If CPU is quite busy we will
do only one iteration. I don't know is it enough to make connection?
True timeout in this case == 0.000001

--
Regards
Denis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-10-15 03:38:55 Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Previous Message Joe Conway 2002-10-15 02:00:46 Re: interesting side effect of autocommit = off