Re: Patch for SortSupport implementation on inet/cdir

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Patch for SortSupport implementation on inet/cdir
Дата
Msg-id CAH2-Wzn94t7H8fwp6vYA+N3mm-4PhJEXJ6TvPVL032Z2u3GQ+w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Patch for SortSupport implementation on inet/cdir  (Peter Geoghegan <pg@bowt.ie>)
Ответы Re: Patch for SortSupport implementation on inet/cdir  (Brandur Leach <brandur@mutelight.org>)
Re: Patch for SortSupport implementation on inet/cdir  (Peter Geoghegan <pg@bowt.ie>)
Список pgsql-hackers
On Fri, Jul 26, 2019 at 6:58 PM Peter Geoghegan <pg@bowt.ie> wrote:
> I found this part of your approach confusing:
>
> > +   /*
> > +    * Number of bits in subnet. e.g. An IPv4 that's /24 is 32 - 24 = 8.
> > +    *
> > +    * However, only some of the bits may have made it into the fixed sized
> > +    * datum, so take the smallest number between bits in the subnet and bits
> > +    * in the datum which are not part of the network.
> > +    */
> > +   datum_subnet_size = Min(ip_maxbits(authoritative) - ip_bits(authoritative),
> > +                           SIZEOF_DATUM * BITS_PER_BYTE - ip_bits(authoritative));
>
> The way that you put a Min() on the subnet size potentially constrains
> the size of the bitmask used for the network component of the
> abbreviated key (the component that comes immediately after the
> ipfamily status bit). Why not just let the bitmask be a bitmask,
> without bringing SIZEOF_DATUM into it? Doing it that way allowed for a
> more streamlined approach, with significantly fewer special cases. I'm
> not sure whether or not your approach had bugs, but I didn't like the
> way you sometimes did a straight "network = ipaddr_datum" assignment
> without masking.

I guess that the idea here was to prevent masking on ipv6 addresses,
though not on ipv4 addresses. Obviously we're only dealing with a
prefix with ipv6 addresses, whereas we usually have the whole raw
ipaddr with ipv4. Not sure if I'm doing the right thing there in v3,
even though the tests pass. In any case, this will need to be a lot
clearer in the final version.

-- 
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Patch for SortSupport implementation on inet/cdir
Следующее
От: Andres Freund
Дата:
Сообщение: Re: POC: Cleaning up orphaned files using undo logs