[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ordered indexing for integers

Quanah Gibson-Mount writes:
> I think every other release has had incompatible changes, and if we are
> contemplating one for 2.4, we need to do it sooner rather than later.

Yes.  And I'd like to see this.

If incompatibility worries people even as early as this in 2.4's life,
we could leave the old format as the default in 2.4, and provide a
slapd.conf-option to enable ordered indexing.

Howard Chu writes:
> Currently the Presence index uses a hardcoded 4 byte key of
> 0x00000001. I want to change it to a 2 byte key of 0x0000 instead, to
> prevent it from colliding with the Integer key space.

What representation are you planning?  My thoughts about it tend towards
DER-inspired formats, something like this:

for values small enough to keep the exact value in the index:
  <0x80 + sign*(#bytes needed)> <those bytes of 2's complement value>
for larger absoulte values:
  same, but for the sake of speed read the value as hex, so we only
  need read the first digits (skipping initial zeros).
for huge values, something like:
  (value < 0 ? 0 : 255),
  <0x8000... + sign*#length octets>
  <initial part of two's complement value-as-hex>

(And if there is going to be a slapd.conf-option, that could just as
well be an option with the max index-key size.)

Too complicated?