From 5ac3dbefcde2e47f484839c50341d40f12e4da53 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 31 Jul 2014 11:29:31 -0700 Subject: [PATCH] ITS#7912 fix index config --- servers/slapd/back-mdb/config.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/servers/slapd/back-mdb/config.c b/servers/slapd/back-mdb/config.c index 7576b33f20..5b402c55a1 100644 --- a/servers/slapd/back-mdb/config.c +++ b/servers/slapd/back-mdb/config.c @@ -619,23 +619,25 @@ mdb_cf_gen( ConfigArgs *c ) c->argc - 1, &c->argv[1], &c->reply); if( rc != LDAP_SUCCESS ) return 1; - c->cleanup = mdb_cf_cleanup; mdb->mi_flags |= MDB_OPEN_INDEX; - if (( mdb->mi_flags & MDB_IS_OPEN ) && !mdb->mi_index_task ) { - /* Start the task as soon as we finish here. Set a long - * interval (10 hours) so that it only gets scheduled once. - */ - if ( c->be->be_suffix == NULL || BER_BVISNULL( &c->be->be_suffix[0] ) ) { - fprintf( stderr, "%s: " - "\"index\" must occur after \"suffix\".\n", - c->log ); - return 1; + if ( mdb->mi_flags & MDB_IS_OPEN ) { + c->cleanup = mdb_cf_cleanup; + if ( !mdb->mi_index_task ) { + /* Start the task as soon as we finish here. Set a long + * interval (10 hours) so that it only gets scheduled once. + */ + if ( c->be->be_suffix == NULL || BER_BVISNULL( &c->be->be_suffix[0] ) ) { + fprintf( stderr, "%s: " + "\"index\" must occur after \"suffix\".\n", + c->log ); + return 1; + } + ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex ); + mdb->mi_index_task = ldap_pvt_runqueue_insert( &slapd_rq, 36000, + mdb_online_index, c->be, + LDAP_XSTRING(mdb_online_index), c->be->be_suffix[0].bv_val ); + ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex ); } - ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex ); - mdb->mi_index_task = ldap_pvt_runqueue_insert( &slapd_rq, 36000, - mdb_online_index, c->be, - LDAP_XSTRING(mdb_online_index), c->be->be_suffix[0].bv_val ); - ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex ); } break; -- 2.39.5