Bug 1255290 - db2index creates index entry from deleted records
Summary: db2index creates index entry from deleted records
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: 389-ds-base
Version: 6.6
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Noriko Hosoi
QA Contact: Viktor Ashirov
Petr Bokoc
Depends On:
Blocks: 1172231 1272422
TreeView+ depends on / blocked
Reported: 2015-08-20 08:35 UTC by Thorsten Scherf
Modified: 2019-11-14 06:53 UTC (History)
5 users (show)

Fixed In Version: 389-ds-base-
Doc Type: Bug Fix
Doc Text:
Tombstone entries no longer create unnecessary index entries When an entry is deleted, its indexed attribute values are also removed from each index file. However, if the entry is turned into a tombstone entry, reindexing previously added the removed attribute value back into the index. This bug has been fixed, and index files no longer contain unnecessary key-value pairs generated by tombstone entries.
Clone Of:
Last Closed: 2016-05-10 19:20:42 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1583613 None None None Never
Red Hat Product Errata RHBA-2016:0737 normal SHIPPED_LIVE 389-ds-base bug fix and enhancement update 2016-05-10 22:29:13 UTC

Description Thorsten Scherf 2015-08-20 08:35:30 UTC
This bug is created as a clone of upstream ticket:

1) Create the entry

    # ldapadd -cvvvv -D "cn=Directory Manager" -W -f /root/ldif/create-posix-user2.ldif
    ldap_initialize( <DEFAULT> )
    add objectClass:
    add cn:
            Non Secure User
    add uid:
    add uidNumber:
    add gidNumber:
    add homeDirectory:
    add loginShell:
    add userpassword:
    adding new entry "uid=user80,ou=People,dc=coe,dc=muc,dc=redhat,dc=com"
    modify complete
2) Check the index file 
    # dbscan -f /var/lib/dirsrv/slapd-tscherf54/db/userRoot/gidNumber.db4 |grep "=80"

3) Delete the entry

    # ldapdelete -vx -D "cn=Directory Manager" -W "uid=user80,ou=People,dc=coe,dc=muc,dc=redhat,dc=com"
    ldap_initialize( <DEFAULT> )
    deleting entry "uid=user80,ou=People,dc=coe,dc=muc,dc=redhat,dc=com"

4) Verify the value from deleted entry has been removed from index
    # dbscan -f /var/lib/dirsrv/slapd-tscherf54/db/userRoot/gidNumber.db4 |grep "=80"

5) Run db2index again 
    # /usr/lib64/dirsrv/slapd-tscherf54/db2index.pl  -n userRoot -D "cn=Directory Manager" -W -t gidNumber
    adding new entry "cn=db2index_2015_8_19_10_34_41, cn=index, cn=tasks, cn=config"

6) Value from removed entry shows up in index file again
    # dbscan -f /var/lib/dirsrv/slapd-tscherf54/db/userRoot/gidNumber.db4 |grep "=80"

7) ldapsearch fails to find the removed entry and there is also nothing related in the error log:

# ldapsearch -x  gidNumber=80
# extended LDIF
# LDAPv3
# base <dc=coe,dc=muc,dc=redhat,dc=com> (default) with scope subtree
# filter: gidNumber=80
# requesting: ALL

# search result
search: 2
result: 0 Success

# numResponses: 1

Comment 2 Viktor Ashirov 2016-03-31 14:29:49 UTC
Build tested:

# ldapadd -D "cn=Directory Manager" -w Secret123
dn: uid=user80,ou=People,dc=example,dc=com
objectClass: top
objectClass: account
objectClass: posixAccount
objectClass: shadowAccount
cn: Non Secure User
uid: user80
gidNumber: 80
uidNumber: 80
homeDirectory: /home/insecure
loginShell: /bin/bash
userPassword: {CLEAR}redhat

adding new entry "uid=user80,ou=People,dc=example,dc=com"

# dbscan -f /var/lib/dirsrv/slapd-rhel6ds/db/userRoot/gidnumber.db4 |grep "=80"

# ldapdelete -D "cn=Directory Manager" -w Secret123 "uid=user80,ou=People,dc=example,dc=com"

after some time entry is removed from the index:
# dbscan -f /var/lib/dirsrv/slapd-rhel6ds/db/userRoot/gidnumber.db4 |grep "=80" -c

# /usr/lib64/dirsrv/slapd-rhel6ds/db2index.pl -n userRoot -D "cn=Directory Manager" -w Secret123 -t gidNumber 
adding new entry "cn=db2index_2016_3_31_16_28_53, cn=index, cn=tasks, cn=config"

# dbscan -f /var/lib/dirsrv/slapd-rhel6ds/db/userRoot/gidnumber.db4 |grep "=80" -c

Value from the removed entry didn't reappear, marking as VERIFIED.

Comment 4 errata-xmlrpc 2016-05-10 19:20:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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