Commit 395e9b25 authored by Howard Chu's avatar Howard Chu
Browse files

ITS#9858 back-mdb: fix index reconfig

parent 9e5701cd
Pipeline #4363 passed with stage
in 40 minutes and 15 seconds
......@@ -446,7 +446,11 @@ fail:
/* If this is leftover from a previous add, commit it */
if ( b->ai_newmask )
b->ai_indexmask = b->ai_newmask;
b->ai_newmask = a->ai_newmask;
/* If the mask changed, remember it */
if ( b->ai_indexmask != a->ai_newmask )
b->ai_newmask = a->ai_newmask;
else /* else ignore it */
b->ai_newmask = 0;
ch_free( a );
rc = 0;
continue;
......
......@@ -349,7 +349,7 @@ mdb_setup_indexer( struct mdb_info *mdb )
MDB_txn *txn;
MDB_cursor *curs;
MDB_val key, data;
int i, rc;
int i, rc, changed = 0;
unsigned short s;
rc = mdb_txn_begin( mdb->mi_dbenv, NULL, 0, &txn );
......@@ -364,17 +364,6 @@ mdb_setup_indexer( struct mdb_info *mdb )
key.mv_size = sizeof( s );
key.mv_data = &s;
/* set indexer task to start at first entry */
{
ID id = 0;
s = 0; /* key 0 records next entryID to index */
data.mv_size = sizeof( ID );
data.mv_data = &id;
rc = mdb_cursor_put( curs, &key, &data, 0 );
if ( rc )
goto done;
}
/* record current and new index masks for all new index definitions */
{
slap_mask_t mask[2];
......@@ -389,8 +378,19 @@ mdb_setup_indexer( struct mdb_info *mdb )
rc = mdb_cursor_put( curs, &key, &data, 0 );
if ( rc )
goto done;
changed = 1;
}
}
/* set indexer task to start at first entry */
if ( changed ) {
ID id = 0;
s = 0; /* key 0 records next entryID to index */
data.mv_size = sizeof( ID );
data.mv_data = &id;
rc = mdb_cursor_put( curs, &key, &data, 0 );
}
done:
mdb_cursor_close( curs );
if ( !rc )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment