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

search/index/rdn problem?


We're running an installation of umich/OpenLDAP since about 3 years containing 
about 200.000 objects providing internal directory services for our bunch of 
customers. We have just migrated all servers from OpenLDAP 1.2.10 to 2.0.7.

One of the objectClasses  is used to route SMTP-Mail into mailboxes, and 
contains entries of following form [example]:

dn: alias=user@domain.com,type=mail,o=kq,c=at
type: alias
objectClass: alias
drop: <mailhost>:<mailer>:<mailbox>

(Please note that the definition of the "alias" objectClass is different from 
the core.schema "alias" objecClass. Yes, that's legacy stuff.)

We are indexing the attributes drop and alias:

index alias,drop eq,sub

In some cases (e.g. helpdesk inqueries), we need to do a substring search 
through the whole bunch of objects as like as

$ ldapsearch -b type=mail,o=kq,c=at -s one "(alias=*@domain.com)"

that worked quite fine and fast with OpenLDAP 1.2.10, but makes the 2.0.7 
server walk through all 150000 entries yielding the search extremely slow 
(several minutes). By playing around and testing i found out that if we 
slightly modify the search filter by adding a second asterisk to the end of 
the domain as like as

$ ldapsearch -b type=mail,o=kq,c=at -s one "(alias=*@domain.com*)"

the server uses the alias index as expected, and delivers the entries as fast 
as the old version (search takes below one second).

More interestingly, a search for another attribute (indexed the same way) like

$ ldapsearch -b type=mail,o=kq,c=at -s one "(drop=*userid)" 

delivers entries fast even _without_ the terminating asterisk. The only 
(obvious) difference between the two searches is that "alias" is used as rdn 
for the entries. It seems that this affects the selection of indices on 
certain searches...

Can anyone enlighten me regarding that issue?

Ing. Alexander Mayrhofer             A.Mayrhofer@kpnqwest.at
Systems Engineer AM171-RIPE          http://www.kpnqwest.at
KPNQwest Austria GmbH.               phone: +43 1 89933 0  
Diefenbachgasse 35, A-1150 Wien      fax: +43 1 89933 533