Re: proposal: rounding up time value less than its unit.

From: David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Gregory Smith <gregsmithpgsql(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: rounding up time value less than its unit.
Date: 2014-09-26 17:43:45
Message-ID: CAKFQuwbNPS9E=crLwH1A4WoSn9LhTmh7BvonoYvB8PWJSGxEAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 26, 2014 at 1:22 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > If we want the narrowest possible fix for this, I think it's "complain
> > if a non-zero value would round to zero". That fixes the original
> > complaint and changes absolutely nothing else. But I think that's
> > kind of wussy. Yeah, rounding 29 seconds down to a special magic
> > value of 0 is more surprising than rounding 30 seconds up to a minute,
> > but the latter is still surprising. We're generally not averse to
> > tighter validation, so why here?
>
> So in other words, if I set "shared_buffers = 100KB", you are proposing
> that that be rejected because it's not an exact multiple of 8KB? This
> seems like it's throwing away one of the fundamental reasons why we
> invented GUC units in the first place.
>
>
​Both Robert and myself at one point made suggestions to this effect but I
believe at this point we are both good simply solving the <1 rounding and
calling it a day.​

> I apparently have got to make this point one more time: if the user
> cares about the difference between 30sec and 1min, then we erred in
> designing the GUC in question; it should have had a smaller unit.
> I am completely not impressed by arguments based on such cases.
> The right fix for such a case is to choose a different unit for the GUC.
>
>
You are right - both those values are probably quite stupid to set
log_rotation_age to...but we cannot error if they choose "1min"

Stephen suggested changing the unit but that particular cure seems to be
considerably worse than simply changing floor() to ceil()

I'm out of arguments for why the minimally invasive solution is, for me,
the best of the currently proposed solutions. That option gets my +1. I
have to ask someone else to actually write such a patch but it seems
straight forward enough as no one has complained that the solution would be
hard to implement - only that they dislike the idea.

David J

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-09-26 18:02:16 Re: Escaping from blocked send() reprised.
Previous Message Stephen Frost 2014-09-26 17:42:56 Re: proposal: rounding up time value less than its unit.