pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Asif Naeem <anaeem.it@gmail.com>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: gettimeofday cause crash on Windows
Date: Thu, 12 Feb 2015 12:14:03 -0300
Message-ID: <20150212151403.GJ3391@alvh.no-ip.org> (raw)
In-Reply-To: <CAEB4t-M7Ap2z8mNrE264yxwT4-0oqJ3acuKETFhZQ6gOzRi8yQ@mail.gmail.com>
References: <CAEB4t-NQ4gSnFC8GfDgAeLx-rKm4-LwtUQMp-TdC6u_xRZdv1A@mail.gmail.com>
	<CAB7nPqTUVZSz0JxvQ6wJT3LKd5hrNTeC7Kv=97pC=rPFJFPhFg@mail.gmail.com>
	<20150212125412.GA9449@alap3.anarazel.de>
	<CAB7nPqRwBtN-AZhXL=gqLipiq-ASDg=cYREDPQrsLQ0VA93ZAA@mail.gmail.com>
	<20150212131316.GB9449@alap3.anarazel.de>
	<CAEB4t-M7Ap2z8mNrE264yxwT4-0oqJ3acuKETFhZQ6gOzRi8yQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Asif Naeem wrote:
> Don’t you feel gettimeofday() implementation is incomplete in current
> state, Is there any other example of function port in PG that could lead to
> crash if its related init_* function is not called earlier ?. As mentioned
> by Michael, it seems not enough documented (release notes etc), at least it
> need to give warning etc instead of simply crash the related process.
> GetSystemTimeAsFileTime() function is less precise but it is quite fast and
> less CPU intensive then GetSystemTimePreciseAsFileTime() function,
> GetSystemTimePreciseAsFileTime() can effect performance of an application.
> With the proposed patch, gettimeofday() function is more safe and more
> versatile, a contrib may use it as per its need of precision. Thanks.

Ideally we would the Precise dance automatically, without requiring the
program to call an initialization function.  Otherwise, programs may
never be updated to use Precise rather than the stock function.  I guess
this is the reason Andres prefers a crash: to force programs to be
updated to include the initialization step.

I wonder if it would work to set the function initially to the
initialization function, so that on the first call the Precise version,
if it exists, is detected (or the stock version otherwise) and set as
the function to call for later -- without requiring a jump in every
subsequent execution of gettimeofday(), of course.  The initialization
function itself would have to return the value returned by
GetSystemTimePreciseAsFileTime, of course.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (16+ messages)  latest in thread

Message-ID: <20150212151403.GJ3391@alvh.no-ip.org>
Permalink:  ../20150212151403.GJ3391@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20150212151403.GJ3391@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, anaeem.it@gmail.com, andres@2ndquadrant.com, michael.paquier@gmail.com
  Subject: Re: gettimeofday cause crash on Windows
  In-Reply-To: <20150212151403.GJ3391@alvh.no-ip.org>
  References: <CAEB4t-NQ4gSnFC8GfDgAeLx-rKm4-LwtUQMp-TdC6u_xRZdv1A@mail.gmail.com> <CAB7nPqTUVZSz0JxvQ6wJT3LKd5hrNTeC7Kv=97pC=rPFJFPhFg@mail.gmail.com> <20150212125412.GA9449@alap3.anarazel.de> <CAB7nPqRwBtN-AZhXL=gqLipiq-ASDg=cYREDPQrsLQ0VA93ZAA@mail.gmail.com> <20150212131316.GB9449@alap3.anarazel.de> <CAEB4t-M7Ap2z8mNrE264yxwT4-0oqJ3acuKETFhZQ6gOzRi8yQ@mail.gmail.com> <20150212151403.GJ3391@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox