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

back-ldif robustness hack (was: Filesystem & backend options for embedded openldap)

Moved from openldap-technical.

Hallvard B Furuseth writes:
> [back-ldif] can leave behind a temporary file if you pull the plug on
> slapd at just the wrong moment, when an entry is being written.  That
> won't affect the entry, but the parent entry cannot be deleted when
> there are temporary files in its directory.

Could fix this as follows.  I guess it's worth the price of slowing down
LDAP Delete:

If a Delete operation would fail with notAllowedOnNonLeaf (rmdir gave
ENOTEMPTY), read the first directory entries.  If we find an .ldif or
a directory, return notAllowedOnNonLeaf.  Remove any temporary files
encountered until then, and try again if we removed them all.

back-ldif serializes write operations, so there won't be a conflict
unless the admin runs slapadd and slapd at the same time.

There could be files someone else has stored there which should not be
deleted, e.g. a README, so tempfiles should have recognizable names like
"<rdn>.tmp<6 random chars>" instead of just "<rdn>.<6 random chars>".