From: Howard Chu Date: Tue, 7 Apr 2026 12:11:14 +0000 (+0100) Subject: ITS#9612 slapd: change index_hash64 default to on X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=11340caa2abc0852945f9b8af4e162dba9298b6a;p=thirdparty%2Fopenldap.git ITS#9612 slapd: change index_hash64 default to on And document that the default is now 64bit, and the option will be removed in the future. --- diff --git a/doc/man/man5/slapd-config.5 b/doc/man/man5/slapd-config.5 index 37054b2ba4..d84fc6b77d 100644 --- a/doc/man/man5/slapd-config.5 +++ b/doc/man/man5/slapd-config.5 @@ -502,14 +502,15 @@ feature. The default is 0. You may also want to set the option. .TP .B olcIndexHash64: { TRUE | FALSE } -Use a 64 bit hash for indexing. The default is to use 32 bit hashes. -These hashes are used for equality and substring indexing. The 64 bit -version may be needed to avoid index collisions when the number of +Use a 64 bit hash for indexing, otherwise 32 bit. The default is +now 64 bit. These hashes are used for equality and substring indexing. +The 64 bit version avoids index collisions when the number of indexed values exceeds ~64 million. (Note that substring indexing generates multiple index values per actual attribute value.) Indices generated with 32 bit hashes are incompatible with the 64 bit -version, and vice versa. Any existing databases must be fully reloaded -when changing this setting. This directive is only supported on 64 bit CPUs. +version, and vice versa. Any existing databases must be fully reindexed +when changing this setting. Since 64 bit is now the default, this option +is deprecated and will eventually be removed. .TP .B olcIndexIntLen: Specify the key length for ordered integer indices. The most significant diff --git a/doc/man/man5/slapd.conf.5 b/doc/man/man5/slapd.conf.5 index 89c77edcb2..6f4503e0bf 100644 --- a/doc/man/man5/slapd.conf.5 +++ b/doc/man/man5/slapd.conf.5 @@ -525,14 +525,15 @@ Read additional configuration information from the given file before continuing with the next line of the current file. .TP .B index_hash64 { on | off } -Use a 64 bit hash for indexing. The default is to use 32 bit hashes. -These hashes are used for equality and substring indexing. The 64 bit -version may be needed to avoid index collisions when the number of +Use a 64 bit hash for indexing, otherwise 32 bit. The default is +now 64 bit. These hashes are used for equality and substring indexing. +The 64 bit version avoids index collisions when the number of indexed values exceeds ~64 million. (Note that substring indexing generates multiple index values per actual attribute value.) Indices generated with 32 bit hashes are incompatible with the 64 bit -version, and vice versa. Any existing databases must be fully reloaded -when changing this setting. This directive is only supported on 64 bit CPUs. +version, and vice versa. Any existing databases must be fully reindexed +when changing this setting. Since 64 bit is now the default, this option +is deprecated and will eventually be removed. .TP .B index_intlen Specify the key length for ordered integer indices. The most significant diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 1fcfe36934..4305f97e94 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -109,10 +109,10 @@ #ifdef LUTIL_HASH64_BYTES #define HASH_BYTES LUTIL_HASH64_BYTES #define HASH_LEN hashlen -static void (*hashinit)(lutil_HASH_CTX *ctx) = lutil_HASHInit; -static void (*hashupdate)(lutil_HASH_CTX *ctx,unsigned char const *buf, ber_len_t len) = lutil_HASHUpdate; -static void (*hashfinal)(unsigned char digest[HASH_BYTES], lutil_HASH_CTX *ctx) = lutil_HASHFinal; -static int hashlen = LUTIL_HASH_BYTES; +static void (*hashinit)(lutil_HASH_CTX *ctx) = lutil_HASH64Init; +static void (*hashupdate)(lutil_HASH_CTX *ctx,unsigned char const *buf, ber_len_t len) = lutil_HASH64Update; +static void (*hashfinal)(unsigned char digest[HASH_BYTES], lutil_HASH_CTX *ctx) = lutil_HASH64Final; +static int hashlen = LUTIL_HASH64_BYTES; #define HASH_Init(c) hashinit(c) #define HASH_Update(c,buf,len) hashupdate(c,buf,len) #define HASH_Final(d,c) hashfinal(d,c) @@ -145,7 +145,7 @@ int slap_hash64( int onoff ) #define HASH_Update(c,buf,len) lutil_HASHUpdate(c,buf,len) #define HASH_Final(d,c) lutil_HASHFinal(d,c) -int slap_has64( int onoff ) +int slap_hash64( int onoff ) { if ( onoff < 0 ) return 0;