mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
Resize indexes when they're full
This commit is contained in:
parent
951a5b5832
commit
1116788475
@ -764,8 +764,8 @@ impl IndexScheduler {
|
|||||||
Ok(task)
|
Ok(task)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register a new task comming from a dump in the scheduler.
|
/// Register a new task coming from a dump in the scheduler.
|
||||||
/// By takinig a mutable ref we're pretty sure no one will ever import a dump while actix is running.
|
/// By taking a mutable ref we're pretty sure no one will ever import a dump while actix is running.
|
||||||
pub fn register_dumped_task(
|
pub fn register_dumped_task(
|
||||||
&mut self,
|
&mut self,
|
||||||
task: TaskDump,
|
task: TaskDump,
|
||||||
@ -939,6 +939,7 @@ impl IndexScheduler {
|
|||||||
Some(batch) => batch,
|
Some(batch) => batch,
|
||||||
None => return Ok(TickOutcome::WaitForSignal),
|
None => return Ok(TickOutcome::WaitForSignal),
|
||||||
};
|
};
|
||||||
|
let index_uid = batch.index_uid().map(ToOwned::to_owned);
|
||||||
drop(rtxn);
|
drop(rtxn);
|
||||||
|
|
||||||
// 1. store the starting date with the bitmap of processing tasks.
|
// 1. store the starting date with the bitmap of processing tasks.
|
||||||
@ -1011,6 +1012,22 @@ impl IndexScheduler {
|
|||||||
// date in the task on disk.
|
// date in the task on disk.
|
||||||
return Ok(TickOutcome::TickAgain(0));
|
return Ok(TickOutcome::TickAgain(0));
|
||||||
}
|
}
|
||||||
|
// If an index said it was full, we need to:
|
||||||
|
// 1. identify which index is full
|
||||||
|
// 2. close the associated environment
|
||||||
|
// 3. resize it
|
||||||
|
// 4. re-schedule tasks
|
||||||
|
Err(Error::Milli(milli::Error::UserError(
|
||||||
|
milli::UserError::MaxDatabaseSizeReached,
|
||||||
|
))) if index_uid.is_some() => {
|
||||||
|
// fixme: add index_uid to match to avoid the unwrap
|
||||||
|
let index_uid = index_uid.unwrap();
|
||||||
|
// fixme: handle error more gracefully? not sure when this could happen
|
||||||
|
self.index_mapper.resize_index(&wtxn, &index_uid)?;
|
||||||
|
wtxn.abort().map_err(Error::HeedTransaction)?;
|
||||||
|
|
||||||
|
return Ok(TickOutcome::TickAgain(0));
|
||||||
|
}
|
||||||
// In case of a failure we must get back and patch all the tasks with the error.
|
// In case of a failure we must get back and patch all the tasks with the error.
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
Loading…
Reference in New Issue
Block a user