mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-12-19 19:06:59 +00:00
Compare commits
9 Commits
openapi-co
...
tmp-releas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a5163a414 | ||
|
|
4c666e9774 | ||
|
|
7a7e75fc41 | ||
|
|
7d0633df22 | ||
|
|
055c65211f | ||
|
|
ae77ca9033 | ||
|
|
2138504df9 | ||
|
|
614affd0b1 | ||
|
|
8582975fc5 |
34
Cargo.lock
generated
34
Cargo.lock
generated
@@ -580,7 +580,7 @@ source = "git+https://github.com/meilisearch/bbqueue#e8af4a4bccc8eb36b2b0442c4a9
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "benchmarks"
|
name = "benchmarks"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
@@ -790,7 +790,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "build-info"
|
name = "build-info"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"time",
|
"time",
|
||||||
@@ -1786,7 +1786,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dump"
|
name = "dump"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"big_s",
|
"big_s",
|
||||||
@@ -2018,7 +2018,7 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "file-store"
|
name = "file-store"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 2.0.17",
|
"thiserror 2.0.17",
|
||||||
@@ -2040,7 +2040,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filter-parser"
|
name = "filter-parser"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"insta",
|
"insta",
|
||||||
"levenshtein_automata",
|
"levenshtein_automata",
|
||||||
@@ -2068,7 +2068,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flatten-serde-json"
|
name = "flatten-serde-json"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"criterion",
|
"criterion",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -2231,7 +2231,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fuzzers"
|
name = "fuzzers"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
@@ -3185,7 +3185,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "index-scheduler"
|
name = "index-scheduler"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"backoff",
|
"backoff",
|
||||||
@@ -3449,7 +3449,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "json-depth-checker"
|
name = "json-depth-checker"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"criterion",
|
"criterion",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -3939,7 +3939,7 @@ checksum = "ae960838283323069879657ca3de837e9f7bbb4c7bf6ea7f1b290d5e9476d2e0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "meili-snap"
|
name = "meili-snap"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"insta",
|
"insta",
|
||||||
"md5 0.8.0",
|
"md5 0.8.0",
|
||||||
@@ -3950,7 +3950,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "meilisearch"
|
name = "meilisearch"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-cors",
|
"actix-cors",
|
||||||
"actix-http",
|
"actix-http",
|
||||||
@@ -4048,7 +4048,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "meilisearch-auth"
|
name = "meilisearch-auth"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"enum-iterator",
|
"enum-iterator",
|
||||||
@@ -4067,7 +4067,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "meilisearch-types"
|
name = "meilisearch-types"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -4105,7 +4105,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "meilitool"
|
name = "meilitool"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
@@ -4139,7 +4139,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "milli"
|
name = "milli"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arroy",
|
"arroy",
|
||||||
"bbqueue",
|
"bbqueue",
|
||||||
@@ -4718,7 +4718,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "permissive-json-pointer"
|
name = "permissive-json-pointer"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"big_s",
|
"big_s",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -7758,7 +7758,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xtask"
|
name = "xtask"
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"build-info",
|
"build-info",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "1.30.0"
|
version = "1.30.1"
|
||||||
authors = [
|
authors = [
|
||||||
"Quentin de Quelen <quentin@dequelen.me>",
|
"Quentin de Quelen <quentin@dequelen.me>",
|
||||||
"Clément Renault <clement@meilisearch.com>",
|
"Clément Renault <clement@meilisearch.com>",
|
||||||
|
|||||||
@@ -662,13 +662,8 @@ impl IndexScheduler {
|
|||||||
// 2. Get the task set for index = name that appeared before the index swap task
|
// 2. Get the task set for index = name that appeared before the index swap task
|
||||||
let mut index_lhs_task_ids = self.queue.tasks.index_tasks(wtxn, lhs)?;
|
let mut index_lhs_task_ids = self.queue.tasks.index_tasks(wtxn, lhs)?;
|
||||||
index_lhs_task_ids.remove_range(task_id..);
|
index_lhs_task_ids.remove_range(task_id..);
|
||||||
let index_rhs_task_ids = if rename {
|
let mut index_rhs_task_ids = self.queue.tasks.index_tasks(wtxn, rhs)?;
|
||||||
let mut index_rhs_task_ids = self.queue.tasks.index_tasks(wtxn, rhs)?;
|
index_rhs_task_ids.remove_range(task_id..);
|
||||||
index_rhs_task_ids.remove_range(task_id..);
|
|
||||||
index_rhs_task_ids
|
|
||||||
} else {
|
|
||||||
RoaringBitmap::new()
|
|
||||||
};
|
|
||||||
|
|
||||||
// 3. before_name -> new_name in the task's KindWithContent
|
// 3. before_name -> new_name in the task's KindWithContent
|
||||||
progress.update_progress(InnerSwappingTwoIndexes::UpdateTheTasks);
|
progress.update_progress(InnerSwappingTwoIndexes::UpdateTheTasks);
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ source: crates/index-scheduler/src/scheduler/test.rs
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### All Tasks:
|
### All Tasks:
|
||||||
0 {uid: 0, batch_uid: 0, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
0 {uid: 0, batch_uid: 0, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
||||||
1 {uid: 1, batch_uid: 1, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
1 {uid: 1, batch_uid: 1, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "a", primary_key: Some("id") }}
|
||||||
2 {uid: 2, batch_uid: 2, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
2 {uid: 2, batch_uid: 2, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
||||||
3 {uid: 3, batch_uid: 3, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
3 {uid: 3, batch_uid: 3, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "c", primary_key: Some("id") }}
|
||||||
4 {uid: 4, batch_uid: 4, status: succeeded, details: { swaps: [IndexSwap { indexes: ("a", "b"), rename: false }, IndexSwap { indexes: ("c", "d"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "b"), rename: false }, IndexSwap { indexes: ("c", "d"), rename: false }] }}
|
4 {uid: 4, batch_uid: 4, status: succeeded, details: { swaps: [IndexSwap { indexes: ("a", "b"), rename: false }, IndexSwap { indexes: ("c", "d"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "b"), rename: false }, IndexSwap { indexes: ("c", "d"), rename: false }] }}
|
||||||
5 {uid: 5, status: enqueued, details: { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }}
|
5 {uid: 5, status: enqueued, details: { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }}
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
@@ -22,10 +22,10 @@ succeeded [0,1,2,3,4,]
|
|||||||
"indexSwap" [4,5,]
|
"indexSwap" [4,5,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Tasks:
|
### Index Tasks:
|
||||||
a [4,5,]
|
a [1,4,5,]
|
||||||
b [0,1,4,]
|
b [0,4,]
|
||||||
c [4,5,]
|
c [3,4,5,]
|
||||||
d [2,3,4,]
|
d [2,4,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Mapper:
|
### Index Mapper:
|
||||||
a: { number_of_documents: 0, field_distribution: {} }
|
a: { number_of_documents: 0, field_distribution: {} }
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ source: crates/index-scheduler/src/scheduler/test.rs
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### All Tasks:
|
### All Tasks:
|
||||||
0 {uid: 0, batch_uid: 0, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
0 {uid: 0, batch_uid: 0, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
||||||
1 {uid: 1, batch_uid: 1, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
1 {uid: 1, batch_uid: 1, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "c", primary_key: Some("id") }}
|
||||||
2 {uid: 2, batch_uid: 2, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
2 {uid: 2, batch_uid: 2, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
||||||
3 {uid: 3, batch_uid: 3, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
3 {uid: 3, batch_uid: 3, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "a", primary_key: Some("id") }}
|
||||||
4 {uid: 4, batch_uid: 4, status: succeeded, details: { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }}
|
4 {uid: 4, batch_uid: 4, status: succeeded, details: { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }}
|
||||||
5 {uid: 5, batch_uid: 5, status: succeeded, details: { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }}
|
5 {uid: 5, batch_uid: 5, status: succeeded, details: { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }}
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
@@ -22,10 +22,10 @@ succeeded [0,1,2,3,4,5,]
|
|||||||
"indexSwap" [4,5,]
|
"indexSwap" [4,5,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Tasks:
|
### Index Tasks:
|
||||||
a [5,]
|
a [3,4,5,]
|
||||||
b [0,1,4,]
|
b [0,4,]
|
||||||
c [4,5,]
|
c [1,4,5,]
|
||||||
d [2,3,4,]
|
d [2,4,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Mapper:
|
### Index Mapper:
|
||||||
a: { number_of_documents: 0, field_distribution: {} }
|
a: { number_of_documents: 0, field_distribution: {} }
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ source: crates/index-scheduler/src/scheduler/test.rs
|
|||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### All Tasks:
|
### All Tasks:
|
||||||
0 {uid: 0, batch_uid: 0, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
0 {uid: 0, batch_uid: 0, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
||||||
1 {uid: 1, batch_uid: 1, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "b", primary_key: Some("id") }}
|
1 {uid: 1, batch_uid: 1, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "c", primary_key: Some("id") }}
|
||||||
2 {uid: 2, batch_uid: 2, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
2 {uid: 2, batch_uid: 2, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
||||||
3 {uid: 3, batch_uid: 3, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "d", primary_key: Some("id") }}
|
3 {uid: 3, batch_uid: 3, status: succeeded, details: { primary_key: Some("id"), old_new_uid: None, new_index_uid: None }, kind: IndexCreation { index_uid: "a", primary_key: Some("id") }}
|
||||||
4 {uid: 4, batch_uid: 4, status: succeeded, details: { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }}
|
4 {uid: 4, batch_uid: 4, status: succeeded, details: { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("c", "b"), rename: false }, IndexSwap { indexes: ("a", "d"), rename: false }] }}
|
||||||
5 {uid: 5, batch_uid: 5, status: succeeded, details: { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }}
|
5 {uid: 5, batch_uid: 5, status: succeeded, details: { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }, kind: IndexSwap { swaps: [IndexSwap { indexes: ("a", "c"), rename: false }] }}
|
||||||
6 {uid: 6, batch_uid: 6, status: succeeded, details: { swaps: [] }, kind: IndexSwap { swaps: [] }}
|
6 {uid: 6, batch_uid: 6, status: succeeded, details: { swaps: [] }, kind: IndexSwap { swaps: [] }}
|
||||||
@@ -23,10 +23,10 @@ succeeded [0,1,2,3,4,5,6,]
|
|||||||
"indexSwap" [4,5,6,]
|
"indexSwap" [4,5,6,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Tasks:
|
### Index Tasks:
|
||||||
a [5,]
|
a [3,4,5,]
|
||||||
b [0,1,4,]
|
b [0,4,]
|
||||||
c [4,5,]
|
c [1,4,5,]
|
||||||
d [2,3,4,]
|
d [2,4,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Mapper:
|
### Index Mapper:
|
||||||
a: { number_of_documents: 0, field_distribution: {} }
|
a: { number_of_documents: 0, field_distribution: {} }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use crate::test_utils::Breakpoint::*;
|
|||||||
use crate::test_utils::{
|
use crate::test_utils::{
|
||||||
index_creation_task, read_json, replace_document_import_task, sample_documents,
|
index_creation_task, read_json, replace_document_import_task, sample_documents,
|
||||||
};
|
};
|
||||||
use crate::IndexScheduler;
|
use crate::{IndexScheduler, Query};
|
||||||
use big_s::S;
|
use big_s::S;
|
||||||
use meili_snap::{json_string, snapshot};
|
use meili_snap::{json_string, snapshot};
|
||||||
use meilisearch_auth::AuthFilter;
|
use meilisearch_auth::AuthFilter;
|
||||||
@@ -404,6 +404,103 @@ fn swap_indexes() {
|
|||||||
snapshot!(snapshot_index_scheduler(&index_scheduler), name: "third_empty_swap_processed");
|
snapshot!(snapshot_index_scheduler(&index_scheduler), name: "third_empty_swap_processed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn swap_indexes_with_correct_task_allocations() {
|
||||||
|
let (index_scheduler, mut handle) = IndexScheduler::test(true, vec![]);
|
||||||
|
|
||||||
|
let to_enqueue = [index_creation_task("a", "id"), index_creation_task("b", "id")];
|
||||||
|
|
||||||
|
for task in to_enqueue {
|
||||||
|
let _ = index_scheduler.register(task, None, false).unwrap();
|
||||||
|
index_scheduler.assert_internally_consistent();
|
||||||
|
}
|
||||||
|
|
||||||
|
handle.advance_n_successful_batches(2);
|
||||||
|
|
||||||
|
let (file0, count0) = sample_documents(&index_scheduler, 1, 1);
|
||||||
|
let (file1, count1) = sample_documents(&index_scheduler, 2, 2);
|
||||||
|
let (file2, count2) = sample_documents(&index_scheduler, 3, 3);
|
||||||
|
let (file3, count3) = sample_documents(&index_scheduler, 4, 4);
|
||||||
|
|
||||||
|
file0.persist().unwrap();
|
||||||
|
file1.persist().unwrap();
|
||||||
|
file2.persist().unwrap();
|
||||||
|
file3.persist().unwrap();
|
||||||
|
|
||||||
|
index_scheduler
|
||||||
|
.register(replace_document_import_task("a", Some("id"), 1, count0), None, false)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
index_scheduler
|
||||||
|
.register(replace_document_import_task("a", Some("id"), 2, count1), None, false)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
index_scheduler
|
||||||
|
.register(replace_document_import_task("b", Some("id"), 3, count2), None, false)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
index_scheduler
|
||||||
|
.register(replace_document_import_task("b", Some("id"), 4, count3), None, false)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
handle.advance_n_successful_batches(2);
|
||||||
|
|
||||||
|
let (a_tasks, _) = index_scheduler
|
||||||
|
.get_tasks_from_authorized_indexes(
|
||||||
|
&Query { index_uids: Some(vec!["a".to_string()]), ..Default::default() },
|
||||||
|
&AuthFilter::default(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(a_tasks.len(), 3);
|
||||||
|
|
||||||
|
let (b_tasks, _) = index_scheduler
|
||||||
|
.get_tasks_from_authorized_indexes(
|
||||||
|
&Query { index_uids: Some(vec!["b".to_string()]), ..Default::default() },
|
||||||
|
&AuthFilter::default(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(b_tasks.len(), 3);
|
||||||
|
|
||||||
|
index_scheduler
|
||||||
|
.register(
|
||||||
|
KindWithContent::IndexSwap {
|
||||||
|
swaps: vec![IndexSwap { indexes: ("a".to_owned(), "b".to_owned()), rename: false }],
|
||||||
|
},
|
||||||
|
None,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
handle.advance_one_successful_batch();
|
||||||
|
|
||||||
|
let (a_after_tasks, _) = index_scheduler
|
||||||
|
.get_tasks_from_authorized_indexes(
|
||||||
|
&Query { index_uids: Some(vec!["a".to_string()]), ..Default::default() },
|
||||||
|
&AuthFilter::default(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let (b_after_tasks, _) = index_scheduler
|
||||||
|
.get_tasks_from_authorized_indexes(
|
||||||
|
&Query { index_uids: Some(vec!["b".to_string()]), ..Default::default() },
|
||||||
|
&AuthFilter::default(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert_eq!(a_after_tasks.len(), 3);
|
||||||
|
assert_eq!(a_after_tasks.len(), b_after_tasks.len());
|
||||||
|
|
||||||
|
for (a, b) in a_tasks.iter().zip(b_after_tasks.iter()) {
|
||||||
|
assert_eq!(a.uid, b.uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (b, a) in b_tasks.iter().zip(a_after_tasks.iter()) {
|
||||||
|
assert_eq!(b.uid, a.uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn swap_indexes_errors() {
|
fn swap_indexes_errors() {
|
||||||
let (index_scheduler, mut handle) = IndexScheduler::test(true, vec![]);
|
let (index_scheduler, mut handle) = IndexScheduler::test(true, vec![]);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ async fn swap_indexes() {
|
|||||||
{
|
{
|
||||||
"uid": 1,
|
"uid": 1,
|
||||||
"batchUid": 1,
|
"batchUid": 1,
|
||||||
"indexUid": "b",
|
"indexUid": "a",
|
||||||
"status": "succeeded",
|
"status": "succeeded",
|
||||||
"type": "documentAdditionOrUpdate",
|
"type": "documentAdditionOrUpdate",
|
||||||
"canceledBy": null,
|
"canceledBy": null,
|
||||||
@@ -266,7 +266,7 @@ async fn swap_indexes() {
|
|||||||
{
|
{
|
||||||
"uid": 4,
|
"uid": 4,
|
||||||
"batchUid": 4,
|
"batchUid": 4,
|
||||||
"indexUid": "d",
|
"indexUid": "c",
|
||||||
"status": "succeeded",
|
"status": "succeeded",
|
||||||
"type": "documentAdditionOrUpdate",
|
"type": "documentAdditionOrUpdate",
|
||||||
"canceledBy": null,
|
"canceledBy": null,
|
||||||
@@ -341,7 +341,7 @@ async fn swap_indexes() {
|
|||||||
{
|
{
|
||||||
"uid": 0,
|
"uid": 0,
|
||||||
"batchUid": 0,
|
"batchUid": 0,
|
||||||
"indexUid": "b",
|
"indexUid": "a",
|
||||||
"status": "succeeded",
|
"status": "succeeded",
|
||||||
"type": "documentAdditionOrUpdate",
|
"type": "documentAdditionOrUpdate",
|
||||||
"canceledBy": null,
|
"canceledBy": null,
|
||||||
|
|||||||
@@ -274,19 +274,19 @@ async fn test_both_apis() {
|
|||||||
"birthyear": 2011,
|
"birthyear": 2011,
|
||||||
"breed": "Beagle"
|
"breed": "Beagle"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": 3,
|
|
||||||
"name": "Max",
|
|
||||||
"gender": "M",
|
|
||||||
"birthyear": 1995,
|
|
||||||
"breed": "Labrador Retriever"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"name": "Vénus",
|
"name": "Vénus",
|
||||||
"gender": "F",
|
"gender": "F",
|
||||||
"birthyear": 2003,
|
"birthyear": 2003,
|
||||||
"breed": "Jack Russel Terrier"
|
"breed": "Jack Russel Terrier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"name": "Max",
|
||||||
|
"gender": "M",
|
||||||
|
"birthyear": 1995,
|
||||||
|
"breed": "Labrador Retriever"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"###);
|
"###);
|
||||||
|
|||||||
@@ -79,16 +79,27 @@ impl RankingRuleGraphTrait for FidGraph {
|
|||||||
|
|
||||||
let mut edges = vec![];
|
let mut edges = vec![];
|
||||||
for fid in all_fields.iter().copied() {
|
for fid in all_fields.iter().copied() {
|
||||||
let weight = weights_map
|
match weights_map.weight(fid) {
|
||||||
.weight(fid)
|
Some(weight) => {
|
||||||
.ok_or(InternalError::FieldidsWeightsMapMissingEntry { key: fid })?;
|
if weight > current_max_weight {
|
||||||
if weight > current_max_weight {
|
current_max_weight = weight;
|
||||||
current_max_weight = weight;
|
}
|
||||||
|
|
||||||
|
edges.push((
|
||||||
|
weight as u32 * term.term_ids.len() as u32,
|
||||||
|
conditions_interner
|
||||||
|
.insert(FidCondition { term: term.clone(), fid: Some(fid) }),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
// Hotfix: this is a temporary solution to handle the case where the weight is not found in the weights map.
|
||||||
|
// This is due to a database corruption in word_fid_docids database.
|
||||||
|
tracing::warn!(
|
||||||
|
"{:?}",
|
||||||
|
InternalError::FieldidsWeightsMapMissingEntry { key: fid }
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
edges.push((
|
|
||||||
weight as u32 * term.term_ids.len() as u32,
|
|
||||||
conditions_interner.insert(FidCondition { term: term.clone(), fid: Some(fid) }),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// always lookup the max_fid if we don't already and add an artificial condition for max scoring
|
// always lookup the max_fid if we don't already and add an artificial condition for max scoring
|
||||||
|
|||||||
Reference in New Issue
Block a user