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

Re: Manual should tell the data range of the configuration parameter

Tianyin Xu wrote:
Hi, guys,

I was quite confused with "index_intlen".

---------- what the manual says ----------
*index_intlen* <*integer*>

Specify  the  key  length  for ordered integer indices. The most
significant bytes of the binary integer will be used  for  index
keys.  The default value is 4, which provides exact indexing for
31 bit values.  A floating point representation is used to index
too large values.


Ok, what the manual told me is that 4 is the default value, and large values
can be handled.

But I finally figured out that 4 is not only the default value but also the
minimum value.

 From the source code, I knew the index_intlen is with the data range [4,
255]. Any out-of-range value will be converted to the boundaries without
notifying users:


/* servers/slapd/bconfig.c */
static int
config_generic(ConfigArgs *c) {

     case CFG_IX_INTLEN:
         if ( c->value_int < SLAP_INDEX_INTLEN_DEFAULT )
             c->value_int = SLAP_INDEX_INTLEN_DEFAULT;
         else if ( c->value_int > 255 )
             c->value_int = 255;
         index_intlen = c->value_int;
To my opinion, as a configuration knob for user tuning, such behavior
(especially the range) should be explicitly exposed to users.

Most users never need to adjust this value. Those who do read the code.

I would suggest to make it explicit by

1. print out logs to notify users
2. write in the manual.

You're welcome to submit a patch to the ITS.

  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/