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

RE: Index corruption and crash in back-ldbm (ITS#2348)

On Wed, 12 Mar 2003 hyc@highlandsun.com wrote:

> Date: Wed, 12 Mar 2003 09:21:49 GMT
> From: hyc@highlandsun.com
> To: openldap-its@OpenLDAP.org
> Subject: RE: Index corruption and crash in back-ldbm (ITS#2348)
> Hm... I think we can change this a bit, instead of testing OR EQUAL:
> 	if (id == ID_BLOCK_ID(idl, i))
> then the ID is already present and doesn't need inserting at all. So the
> other tests can be left as-is, we can just return early if the id is equal.

I'm afraid that is not always a valid assumption.

There may be an exceptional case where the first id in a partial block
is deleted wihtout the entry in the index (the thingy that points to the
partial block) is modified.  Then the id may be equal to ID_BLOCK_ID(idl,
i) and yet the id does not exist the the partial block.

If ID_BLOCK_ID(idl, i) were adjusted every time the first item of a partial
block is removed it would be a different matter, but as far as I can tell
this is not the case.

This would only happen in very (probably) rare cases, though, but I
think that it could happen for an attribute index where the exatly right
attribute is removed from exactly the right ldap entry and later that
very same attribute with the very same value is added back to the very
same ldap entry.