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

Re: Index corruption




Christine Robertson wrote:
> 
> Hi all,
> 
> We are running 2.0.22 under FreeBSD 4.5.  This morning my
> indexes got corrupted in an interesting manner, so that
> the directory believed it had a record which didn't actually
> exist.
> 
> I found one other case rather like it in the archives, but
> no real explanation.
> 
> I tried to add a very simple posixAccount record:
> 
> dn: uid=chris3,dc=au,dc=cordoors,dc=com
> objectClass: posixAccount
> uidNumber: 1946
> gidNumber: 400
> homeDirectory: /usr/users/chris
> loginShell: /bin/tcsh
> gecos: Chris Robertson
> cn: Chris Robertson
> uid: chris3
> userPassword: x
> 
> and the add failed with a "record already exists" message.
> Tried to delete the DN, and got the following message:
> 
>  Delete Result: Unknown error (80)
>  Additional info: DN index delete failed

I got messages like this when I:
a) ran slapadd twice ("Oh dear, I forgot the -c.  Well, I'll just run it
again.  After all, LDAP doesn't allow duplicate records, so why would
slapadd create them?"  But of course it does so happily.)
b) deleted a (duplicated) record
c) tried to re-create the record ("already exists")
d) tried to delete the record again ("index delete failed")

I ended up dumping the database to a file and running a perl script
against it to eliminate the duplicates.  If possible, you should keep
the last record of a set of duplicates rather than the first.  OpenLDAP
seems to update only the last record when duplicates are present.

If you have a slapcat dump in foo.ldif, compare the output of:
grep '^dn: ' foo.ldif | wc -l
grep '^dn: ' foo.ldif | sort | uniq | wc -l
If the numbers are different, you probably have duplicate DNs in your
database.
> 
> I tried adding a similar record with uid=chris4, and
> had no problems adding it or deleting it again.
> 
> I dumped the directory with slapcat, and the uid=chris3
> record definitely didn't exist.  I shut down slapd
> and re-made the indexes; no change.  I physically
> removed the indexes and re-made them; no change.
> I deleteled almost every record from the directory and
> re-made the indexes; no change.
> 
> The only thing that worked was removing the whole damn
> directory and re-creating it from scratch with slapadd.
> 
> Can anyone shed any light on this?  I'm not aware of
> anything out of the ordinary happening around the time
> the indexes got munched.
> 
> --Chris Robertson
> Corinthian Engineering