Actually abort in case of corrupted index

This commit is contained in:
Louis Dureuil 2024-04-04 11:02:54 +02:00
parent ba40c8f31c
commit 4dd420bbea
No known key found for this signature in database

View File

@ -1020,13 +1020,18 @@ impl IndexScheduler {
let mut index_wtxn = index.write_txn()?; 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)? { if index.is_corrupted(&index_wtxn)? {
tracing::error!("Aborting task due to corrupted index"); tracing::error!("Aborting task due to corrupted index");
index_wtxn.abort(); 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(); index.check_document_facet_consistency(&index_wtxn)?.check();