Get rids of the unecessary tasks when an index_uid is specified

This commit is contained in:
Irevoire 2022-10-27 18:00:04 +02:00
parent d16ea755d8
commit 01687c87a2
No known key found for this signature in database
GPG key ID: 7A6A970C96104F1B
2 changed files with 23 additions and 3 deletions

View file

@ -589,10 +589,12 @@ impl IndexScheduler {
) -> Result<RoaringBitmap> {
let mut tasks = self.get_task_ids(rtxn, query)?;
// If the query contains a list of index_uid, then we must exclude IndexSwap tasks
// from the result (because it is not publicly associated with any index)
// If the query contains a list of `index_uid`, then we must exclude all the kind that
// arn't associated to one and only one index.
if query.index_uid.is_some() {
tasks -= self.get_kind(rtxn, Kind::IndexSwap)?
for kind in enum_iterator::all::<Kind>().filter(|kind| !kind.related_to_one_index()) {
tasks -= self.get_kind(rtxn, kind)?;
}
}
// Any task that is internally associated with a non-authorized index