Bug 463774 - index files for database should be deleted when db is deleted.
Summary: index files for database should be deleted when db is deleted.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: 389
Classification: Retired
Component: Database - General
Version: 1.1.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Chandrasekar Kannan
URL:
Whiteboard:
Depends On:
Blocks: 249650 FDS1.2.0
TreeView+ depends on / blocked
 
Reported: 2008-09-24 16:35 UTC by Ade Lee
Modified: 2015-01-04 23:34 UTC (History)
3 users (show)

Fixed In Version: 8.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-04-29 23:06:39 UTC
Embargoed:


Attachments (Terms of Use)
cvs diff ldap/servers/slapd/back-ldbm/ldbm_instance_config.c (3.94 KB, patch)
2008-11-06 00:45 UTC, Noriko Hosoi
no flags Details | Diff
cvs commit message (1.04 KB, text/plain)
2008-11-06 21:06 UTC, Noriko Hosoi
no flags Details

Description Ade Lee 2008-09-24 16:35:33 UTC
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:

Comment 1 Noriko Hosoi 2008-11-06 00:45:45 UTC
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.

Comment 2 Noriko Hosoi 2008-11-06 00:57:45 UTC
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.

Comment 3 Noriko Hosoi 2008-11-06 21:06:56 UTC
Created attachment 322787 [details]
cvs commit message

Reviewed by Nathan (Thank you!!)

Checked in into CVS HEAD.

Comment 4 Yi Zhang 2009-04-01 18:52:38 UTC
verified on rhel5 i386 with console remove function : test result pass

verified on rhel4 i386 with console remove function : test result pass

Comment 5 Chandrasekar Kannan 2009-04-29 23:06:39 UTC
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


Note You need to log in before you can comment on or make changes to this bug.