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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joe Conway <mail(at)joeconway(dot)com>, Denis A Ustimenko <denis(at)oldham(dot)ru>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date: 2002-10-16 15:05:40
Message-ID: 200210161505.g9GF5eZ26278@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Tom Lane wrote:
> >> Still, one could ask why we are expending extra cycles to make the
> >> timeout more accurate. Who the heck needs an accurate timeout on
> >> connect? Can you really give a use-case where the user won't have
> >> picked a number out of the air anyway?
>
> > I think we do need to properly compute the timeout on an EINTR of
> > select() because if we don't, a 30 second timeout could become 90
> > seconds if select() is interrupted. The other time() calls are needed,
> > one above the loop, and one inside the loop.
>
> AFAICS we need one time() call at the start, and then one inside the
> select loop. I haven't looked at your recent patches, but you said
> something about putting two calls in the loop; that seems like overkill.

Yes, one call at the start, and one in the loop. We need another in
pqWaitTimeout, but only if we hit EINTR. As the code stands now we do
time() unconditionally in pqWaitTimeout too because we only have to pass
in the funish time. If we want to pass in both finish and duration (for
use as select() timeout param), then we can eliminate the time() call in
there for the non-EINTR case. Is it worth the added code complexity?
That is what I am not sure about.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-10-16 15:47:00 Re: index theory
Previous Message Bruce Momjian 2002-10-16 15:02:10 Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c