diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index edbf2cae0..aa060850b 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -84,7 +84,7 @@ pub(crate) enum IndexOperation { }, Settings { index_uid: String, - // TODO what's that boolean, does it mean that it removes things or what? + // The boolean indicates if it's a settings deletion or creation. settings: Vec<(bool, Settings)>, tasks: Vec, }, @@ -92,7 +92,7 @@ pub(crate) enum IndexOperation { index_uid: String, cleared_tasks: Vec, - // TODO what's that boolean, does it mean that it removes things or what? + // The boolean indicates if it's a settings deletion or creation. settings: Vec<(bool, Settings)>, settings_tasks: Vec, }, @@ -105,7 +105,7 @@ pub(crate) enum IndexOperation { content_files: Vec, document_import_tasks: Vec, - // TODO what's that boolean, does it mean that it removes things or what? + // The boolean indicates if it's a settings deletion or creation. settings: Vec<(bool, Settings)>, settings_tasks: Vec, }, @@ -1031,23 +1031,24 @@ impl IndexScheduler { } IndexOperation::Settings { index_uid: _, settings, mut tasks } => { let indexer_config = self.index_mapper.indexer_config(); - // TODO merge the settings to only do *one* reindexation. + let mut builder = milli::update::Settings::new(index_wtxn, index, indexer_config); + for (task, (_, settings)) in tasks.iter_mut().zip(settings) { let checked_settings = settings.clone().check(); task.details = Some(Details::SettingsUpdate { settings: Box::new(settings) }); - - let mut builder = - milli::update::Settings::new(index_wtxn, index, indexer_config); apply_settings_to_builder(&checked_settings, &mut builder); - let must_stop_processing = self.must_stop_processing.clone(); - builder.execute( - |indexing_step| debug!("update: {:?}", indexing_step), - || must_stop_processing.get(), - )?; + // We can apply the status right now and if an update fail later + // the whole batch will be marked as failed. task.status = Status::Succeeded; } + let must_stop_processing = self.must_stop_processing.clone(); + builder.execute( + |indexing_step| debug!("update: {:?}", indexing_step), + || must_stop_processing.get(), + )?; + Ok(tasks) } IndexOperation::SettingsAndDocumentImport {