Skip site navigation (1) Skip section navigation (2)

Re: [PATCHES] BUG #2569: statement_timeout bug on Windows

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, James <im-james(at)hotmail(dot)com>, pgsql-bugs(at)postgresql(dot)org, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCHES] BUG #2569: statement_timeout bug on Windows
Date: 2006-08-09 20:41:26
Message-ID: 200608092041.k79KfQi18848@momjian.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackerspgsql-patches
Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> ! 				/* WaitForSingleObjectEx() uses milliseconds */
> > ! 				waittime = timerCommArea.value.it_value.tv_usec / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
> 
> Seems like this probably ought to round up not down:
> 
> 	waittime = (timerCommArea.value.it_value.tv_usec + 999) / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
> 
> Otherwise, an attempt to wait for 100 usec would convert to waittime 0,
> which seems like a bad thing.  In general the semantics of timed waits
> are always supposed to be "you wait at least this long".

I thought about that, but because statement_timeout is in millis, and
not micros, we can't have a value that gets rounded down.   I am
thinking a cleaner solution is to check for secs and if that is 0 and
microsecs < 1000, you set millis = 1.

Patch attached and applied to head and 8.1.X.

-- 
  Bruce Momjian   bruce(at)momjian(dot)us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Attachment: /rtmp/diff
Description: text/x-diff (967 bytes)

In response to

Responses

pgsql-hackers by date

Next:From: Jim C. NasbyDate: 2006-08-09 20:42:40
Subject: Re: Buildfarm failure on ecpg/test/pgtypeslib
Previous:From: Bruce MomjianDate: 2006-08-09 20:34:47
Subject: Re: WIN32 Build?

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-08-09 20:50:44
Subject: Re: [PATCHES] BUG #2569: statement_timeout bug on Windows
Previous:From: Tom LaneDate: 2006-08-09 20:10:38
Subject: Re: [PATCHES] BUG #2569: statement_timeout bug on Windows

pgsql-patches by date

Next:From: Andreas PflugDate: 2006-08-09 20:46:41
Subject: Re: remote query debugging was: Plugins redux
Previous:From: Tom LaneDate: 2006-08-09 20:17:02
Subject: Re: Maintaining cluster order on insert

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group