Re: XLByte* usage

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: XLByte* usage
Date: 2012-12-18 12:25:04
Message-ID: 20121218122503.GA17127@alap2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2012-12-18 13:14:10 +0100, Dimitri Fontaine wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > In 2) unfortunately one has to make decision in which way to simplify
> > negated XLByte(LT|LE) expressions. I tried to make that choice very
> > careful and when over every change several times after that, so I hope
> > there aren't any bad changes, but more eyeballs are needed.
>
> + if (lsn > PageGetLSN(page))
> + if (lsn >= PageGetLSN(page))
> + if (lsn <= PageGetLSN(page))
> + if (max_lsn < this_lsn)
>
> My only comment here would be that I would like it much better that the
> code always use the same operators, and as we read from left to right,
> that we pick < and <=.

I did that in most places (check the xlog.c changes), but in this case
it didn't seem to be appropriate because because that would have meant
partially reversing the order of operands which would have looked
confusing as well, given this check is a common patter across nearly
every xlog replay function.
Imo its a good idea trying to choose < or <= as operator but its also
important to keep the order consistent inside a single function/similar
functions.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2012-12-18 12:42:25 Review : Add hooks for pre- and post-processor executables for COPY and \copy
Previous Message Dimitri Fontaine 2012-12-18 12:14:10 Re: XLByte* usage