Description of problem: When a database is deleted - by removing the cn=<foo>, cn=ldbm database, cn=plugins, cn=config entry, then the OS directory containing the indexes for this database should be removed by the DS. A use case for this is in https://bugzilla.redhat.com/show_bug.cgi?id=224902. See comment #5 Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Create a new database 2. Remove the cn=foo, cn=ldbm database, cn=plugins, cn=config entry 3. The directories for the indexes for this DB still exist. Actual results: The directories for the indexes for this DB still exist. Expected results: This should be removed. Additional info:
Created attachment 322659 [details] cvs diff ldap/servers/slapd/back-ldbm/ldbm_instance_config.c File: ldap/servers/slapd/back-ldbm/ldbm_instance_config.c Fix Description: The callback ldbm_instance_post_delete_instance_entry_callback is called when the backend instance is removed. In the callback, there was a code to cleanup the primary db (id2entry.db#), but no other index files nor the instance directory. Also, the code included a bug to get the instance directory path. The proposed code gets the right instance directory path and cleans up all the files in the directory, then removes the backend instance directory.
How to verify the bug: 1) mkdir /tmp/db; then add the following entries. $ /usr/lib64/mozldap/ldapmodify -D 'cn=Directory Manager' -w <pw> -a dn: cn=testRoot,cn=ldbm database, cn=plugins, cn=config changetype: add objectClass: top objectClass: extensibleObject objectClass: nsBackendInstance cn: testRoot nsslapd-suffix: dc=test,dc=com nsslapd-cachesize: -1 nsslapd-cachememsize: 10485760 nsslapd-directory: /tmp/db/testRoot dn: cn="dc=test,dc=com",cn=mapping tree, cn=config changetype: add objectClass: top objectClass: extensibleObject objectClass: nsMappingTree nsslapd-state: Backend cn: "dc=test,dc=com" cn: dc=test,dc=com nsslapd-backend: testRoot 2) run dbgen.pl to generate an ldif file. $ dbgen.pl -s "dc=test,dc=com" -o test1k.ldif -n 1000 3) import the ldif file. ./stop-slapd ./ldif2db -n testRoot -i /path/to/test1k.ldif ./start-slapd 4) check that /tmp/db/testRoot and db files underneath exist. 5) delete the backend instance. $ /usr/lib64/mozldap/ldapdelete -D 'cn=Directory Manager' -w <pw> cn=aci, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=cn, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=encrypted attribute keys, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=encrypted attributes, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=entrydn, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=givenName, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=mailAlternateAddress, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=mail, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=mailHost, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=member, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=memberOf, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=monitor, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=nscpEntryDN, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=nsds5ReplConflict, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=nsuniqueid, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=ntUniqueId, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=ntUserDomainId, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=numsubordinates, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=objectclass, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=owner, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=parentid, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=seeAlso, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=sn, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=telephoneNumber, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=uid, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=uniquemember, cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=index, cn=testRoot, cn=ldbm database, cn=plugins, cn=config cn=testRoot,cn=ldbm database, cn=plugins, cn=config cn="dc=test,dc=com",cn=mapping tree, cn=config 6) check that /tmp/db/testRoot is removed.
Created attachment 322787 [details] cvs commit message Reviewed by Nathan (Thank you!!) Checked in into CVS HEAD.
verified on rhel5 i386 with console remove function : test result pass verified on rhel4 i386 with console remove function : test result pass
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2009-0455.html