Re: Strange coding in _mdfd_openseg()

2020-01-26 Thread Thomas Munro
On Sun, Jan 26, 2020 at 8:23 AM Noah Misch wrote: > Agreed. The rest of md.c won't cope with a hole in this array, so allowing > less-than-or-equal here is futile. The patch in the original post looks fine. Thanks. Pushed.

Re: Strange coding in _mdfd_openseg()

2020-01-25 Thread Noah Misch
On Thu, Apr 04, 2019 at 12:15:52PM +0900, Kyotaro HORIGUCHI wrote: > At Wed, 3 Apr 2019 13:47:46 -0700, Andres Freund wrote > in <20190403204746.2yumq7c2mirmo...@alap3.anarazel.de> > > On 2019-04-04 09:24:49 +1300, Thomas Munro wrote: > > > On Wed, Apr 3, 2019 at 5:34 PM Kyotaro HORIGUCHI > > >

Re: Strange coding in _mdfd_openseg()

2019-04-07 Thread Kyotaro HORIGUCHI
At Fri, 5 Apr 2019 18:44:15 +1300, Thomas Munro wrote in > On Thu, Apr 4, 2019 at 4:16 PM Kyotaro HORIGUCHI > wrote: > > At Wed, 3 Apr 2019 13:47:46 -0700, Andres Freund wrote > > in <20190403204746.2yumq7c2mirmo...@alap3.anarazel.de> > > > Yea, I totally agree it's weird. I'm not sure if I'd

Re: Strange coding in _mdfd_openseg()

2019-04-04 Thread Thomas Munro
On Thu, Apr 4, 2019 at 4:16 PM Kyotaro HORIGUCHI wrote: > At Wed, 3 Apr 2019 13:47:46 -0700, Andres Freund wrote > in <20190403204746.2yumq7c2mirmo...@alap3.anarazel.de> > > Yea, I totally agree it's weird. I'm not sure if I'd go for an assertion > > of equality, or just invert the >= (which I a

Re: Strange coding in _mdfd_openseg()

2019-04-03 Thread Kyotaro HORIGUCHI
Hello. At Wed, 3 Apr 2019 13:47:46 -0700, Andres Freund wrote in <20190403204746.2yumq7c2mirmo...@alap3.anarazel.de> > Hi, > > On 2019-04-04 09:24:49 +1300, Thomas Munro wrote: > > On Wed, Apr 3, 2019 at 5:34 PM Kyotaro HORIGUCHI > > wrote: > > > I may be missing something, but it seems possib

Re: Strange coding in _mdfd_openseg()

2019-04-03 Thread Andres Freund
Hi, On 2019-04-04 09:24:49 +1300, Thomas Munro wrote: > On Wed, Apr 3, 2019 at 5:34 PM Kyotaro HORIGUCHI > wrote: > > I may be missing something, but it seems possible that > > _mdfd_getseg calls it with segno > opensegs. > > > > | for (nextsegno = reln->md_num_open_segs[forknum]; > > Here n

Re: Strange coding in _mdfd_openseg()

2019-04-03 Thread Thomas Munro
On Wed, Apr 3, 2019 at 5:34 PM Kyotaro HORIGUCHI wrote: > I may be missing something, but it seems possible that > _mdfd_getseg calls it with segno > opensegs. > > | for (nextsegno = reln->md_num_open_segs[forknum]; Here nextsegno starts out equal to opensegs. > | nextsegno <= targe

Re: Strange coding in _mdfd_openseg()

2019-04-02 Thread Kyotaro HORIGUCHI
At Wed, 3 Apr 2019 17:14:36 +1300, Thomas Munro wrote in > Hello, > > I think the following conditional code is misleading, and I wonder if > it would be better like so: > > --- a/src/backend/storage/smgr/md.c > +++ b/src/backend/storage/smgr/md.c > @@ -1787,8 +1787,13 @@ _mdfd_openseg(SMgrRel

Strange coding in _mdfd_openseg()

2019-04-02 Thread Thomas Munro
Hello, I think the following conditional code is misleading, and I wonder if it would be better like so: --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -1787,8 +1787,13 @@ _mdfd_openseg(SMgrRelation reln, ForkNumber forknum, BlockNumber segno, if (fd < 0)