Add the snapshots directory path to the IndexScheduler

This commit is contained in:
Kerollmops 2022-10-25 10:53:25 +02:00 committed by Clément Renault
parent e0548e42e7
commit c063f154fb
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
3 changed files with 12 additions and 2 deletions

View File

@ -26,6 +26,7 @@ pub fn snapshot_index_scheduler(scheduler: &IndexScheduler) -> String {
index_mapper, index_mapper,
wake_up: _, wake_up: _,
dumps_path: _, dumps_path: _,
snapshots_path: _,
test_breakpoint_sdr: _, test_breakpoint_sdr: _,
planned_failures: _, planned_failures: _,
run_loop_iteration: _, run_loop_iteration: _,

View File

@ -242,6 +242,9 @@ pub struct IndexScheduler {
/// The path used to create the dumps. /// The path used to create the dumps.
pub(crate) dumps_path: PathBuf, pub(crate) dumps_path: PathBuf,
/// The path used to create the snapshots.
pub(crate) snapshots_path: PathBuf,
// ================= test // ================= test
// The next entry is dedicated to the tests. // The next entry is dedicated to the tests.
/// Provide a way to set a breakpoint in multiple part of the scheduler. /// Provide a way to set a breakpoint in multiple part of the scheduler.
@ -261,8 +264,8 @@ pub struct IndexScheduler {
run_loop_iteration: Arc<RwLock<usize>>, run_loop_iteration: Arc<RwLock<usize>>,
} }
impl IndexScheduler { impl IndexScheduler {
fn private_clone(&self) -> Self { fn private_clone(&self) -> IndexScheduler {
Self { IndexScheduler {
env: self.env.clone(), env: self.env.clone(),
must_stop_processing: self.must_stop_processing.clone(), must_stop_processing: self.must_stop_processing.clone(),
processing_tasks: self.processing_tasks.clone(), processing_tasks: self.processing_tasks.clone(),
@ -277,6 +280,7 @@ impl IndexScheduler {
index_mapper: self.index_mapper.clone(), index_mapper: self.index_mapper.clone(),
wake_up: self.wake_up.clone(), wake_up: self.wake_up.clone(),
autobatching_enabled: self.autobatching_enabled, autobatching_enabled: self.autobatching_enabled,
snapshots_path: self.snapshots_path.clone(),
dumps_path: self.dumps_path.clone(), dumps_path: self.dumps_path.clone(),
#[cfg(test)] #[cfg(test)]
test_breakpoint_sdr: self.test_breakpoint_sdr.clone(), test_breakpoint_sdr: self.test_breakpoint_sdr.clone(),
@ -308,6 +312,7 @@ impl IndexScheduler {
/// - `tasks_path`: the path to the folder containing the task databases /// - `tasks_path`: the path to the folder containing the task databases
/// - `update_file_path`: the path to the file store containing the files associated to the tasks /// - `update_file_path`: the path to the file store containing the files associated to the tasks
/// - `indexes_path`: the path to the folder containing meilisearch's indexes /// - `indexes_path`: the path to the folder containing meilisearch's indexes
/// - `snapshots_path`: the path to the folder containing the snapshots
/// - `dumps_path`: the path to the folder containing the dumps /// - `dumps_path`: the path to the folder containing the dumps
/// - `index_size`: the maximum size, in bytes, of each meilisearch index /// - `index_size`: the maximum size, in bytes, of each meilisearch index
/// - `indexer_config`: configuration used during indexing for each meilisearch index /// - `indexer_config`: configuration used during indexing for each meilisearch index
@ -319,6 +324,7 @@ impl IndexScheduler {
update_file_path: PathBuf, update_file_path: PathBuf,
indexes_path: PathBuf, indexes_path: PathBuf,
dumps_path: PathBuf, dumps_path: PathBuf,
snapshots_path: PathBuf,
task_db_size: usize, task_db_size: usize,
index_size: usize, index_size: usize,
indexer_config: IndexerConfig, indexer_config: IndexerConfig,
@ -356,6 +362,7 @@ impl IndexScheduler {
wake_up: Arc::new(SignalEvent::auto(true)), wake_up: Arc::new(SignalEvent::auto(true)),
autobatching_enabled, autobatching_enabled,
dumps_path, dumps_path,
snapshots_path,
#[cfg(test)] #[cfg(test)]
test_breakpoint_sdr, test_breakpoint_sdr,
@ -963,6 +970,7 @@ mod tests {
tempdir.path().join("db_path"), tempdir.path().join("db_path"),
tempdir.path().join("file_store"), tempdir.path().join("file_store"),
tempdir.path().join("indexes"), tempdir.path().join("indexes"),
tempdir.path().join("snapshots"),
tempdir.path().join("dumps"), tempdir.path().join("dumps"),
1024 * 1024, 1024 * 1024,
1024 * 1024, 1024 * 1024,

View File

@ -113,6 +113,7 @@ pub fn setup_meilisearch(opt: &Opt) -> anyhow::Result<(IndexScheduler, AuthContr
opt.db_path.join("tasks"), opt.db_path.join("tasks"),
opt.db_path.join("update_files"), opt.db_path.join("update_files"),
opt.db_path.join("indexes"), opt.db_path.join("indexes"),
opt.snapshot_dir.clone(),
opt.dumps_dir.clone(), opt.dumps_dir.clone(),
opt.max_task_db_size.get_bytes() as usize, opt.max_task_db_size.get_bytes() as usize,
opt.max_index_size.get_bytes() as usize, opt.max_index_size.get_bytes() as usize,