From 4dd420bbea6f33808ffb08894cb15bde37cc63cd Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Thu, 4 Apr 2024 11:02:54 +0200 Subject: [PATCH] Actually abort in case of corrupted index --- index-scheduler/src/batch.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index 1e3f25e4c..83c0a8128 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -1020,13 +1020,18 @@ impl IndexScheduler { let mut index_wtxn = index.write_txn()?; + let mut tasks = self.apply_index_operation(&mut index_wtxn, &index, op)?; + if index.is_corrupted(&index_wtxn)? { tracing::error!("Aborting task due to corrupted index"); index_wtxn.abort(); - return Err(crate::Error::CorruptedIndex); - } + for task in tasks.iter_mut() { + task.status = Status::Failed; + task.error = Some(Error::CorruptedIndex.into()); + } - let tasks = self.apply_index_operation(&mut index_wtxn, &index, op)?; + return Ok(tasks); + } index.check_document_facet_consistency(&index_wtxn)?.check();