[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
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.
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc
Symas: Premier OpenSource Development and Support
> -----Original Message-----
> From: vek@pharmapartners.nl [mailto:vek@pharmapartners.nl]
> Sent: Monday, March 10, 2003 2:09 AM
> To: hyc@highlandsun.com
> Cc: openldap-its@OpenLDAP.org
> Subject: RE: Index corruption and crash in back-ldbm (ITS#2348)
>
>
> On Wed, 5 Mar 2003 hyc@highlandsun.com wrote:
>
> > Date: Wed, 5 Mar 2003 23:08:18 GMT
> > From: hyc@highlandsun.com
> > To: openldap-its@OpenLDAP.org
> > Subject: RE: Index corruption and crash in back-ldbm (ITS#2348)
> >
> > Ignore that previous message. Your bug analysis and patch
> are exactly right.
> > I am committing it to both 2.1 and 2.0.
> >
>
> It wasn't complete, though. The events shown below can be reproduced
> by running slapindex without erasing the indexes first, thus when
> all the id entries already exist. If you lower
> db->dbc_maxids while testing
> it would happen much sooner.
>
>
> Must select the block where id is greater OR EQUEAL to the lower
> bound for this block. If id is equal to the lower bound and
> the previous block is selected for insert then the following message
> may be triggered.
>
> "idl_insert_key: id %ld is already in next block\n"
>
> The condition for this message is that the previous block is full
> and the id already exist in the following block. If the previous
> block is not full then the id is inserted there even when it may
> already exist in the following block, thus an inconsistency. When
> this happens no message is generated.
>
> The patch is for CVS id 1.80.
>
>
> --- idl.c-1.80 Mon Mar 10 10:43:31 2003
> +++ idl.c Mon Mar 10 10:48:07 2003
> @@ -553,11 +553,11 @@
>
> #ifndef USE_INDIRECT_NIDS
> /* select the block to try inserting into *//* XXX
> linear search XXX */
> - for ( i = 0; !ID_BLOCK_NOID(idl, i) && id >
> ID_BLOCK_ID(idl, i); i++ )
> + for ( i = 0; !ID_BLOCK_NOID(idl, i) && id >=
> ID_BLOCK_ID(idl, i); i++ )
> ; /* NULL */
> #else
> i = idl_find(idl, id);
> - if (ID_BLOCK_ID(idl, i) < id)
> + if (ID_BLOCK_ID(idl, i) <= id)
> i++;
> #endif
>
> @@ -567,6 +567,11 @@
> } else {
> first = 1;
> }
> +
> + /* At this point the following condition must be true:
> + * ID_BLOCK_ID(idl, i) <= id && id < ID_BLOCK_ID(idl, i+1)
> + * except when i is the first or the last block.
> + */
>
> /* get the block */
> cont_alloc( &k2, &key );
>
>
>
>
>
> --
>
> Villy