mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
Make v4::load_dump copy each part a the dump
This commit is contained in:
parent
26e7bdf702
commit
deba0cc096
@ -1,6 +1,9 @@
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
use fs_extra::dir::{self, CopyOptions};
|
||||
use log::info;
|
||||
use tempfile::tempdir;
|
||||
|
||||
use crate::dump::Metadata;
|
||||
use crate::options::IndexerOpts;
|
||||
@ -15,9 +18,36 @@ pub fn load_dump(
|
||||
) -> anyhow::Result<()> {
|
||||
info!("Patching dump V4 to dump V5...");
|
||||
|
||||
let patched_dir = tempdir()?;
|
||||
let options = CopyOptions::default();
|
||||
|
||||
// Indexes
|
||||
dir::copy(src.as_ref().join("indexes"), patched_dir.path(), &options)?;
|
||||
|
||||
// Index uuids
|
||||
dir::copy(
|
||||
src.as_ref().join("index_uuids"),
|
||||
patched_dir.path(),
|
||||
&options,
|
||||
)?;
|
||||
|
||||
// Metadata
|
||||
fs::copy(
|
||||
src.as_ref().join("metadata.json"),
|
||||
patched_dir.path().join("metadata.json"),
|
||||
)?;
|
||||
|
||||
// Updates
|
||||
dir::copy(src.as_ref().join("updates"), patched_dir.path(), &options)?;
|
||||
|
||||
// Keys
|
||||
if src.as_ref().join("keys").exists() {
|
||||
fs::copy(src.as_ref().join("keys"), patched_dir.path().join("keys"))?;
|
||||
}
|
||||
|
||||
super::v5::load_dump(
|
||||
meta,
|
||||
src,
|
||||
patched_dir.path(),
|
||||
dst,
|
||||
index_db_size,
|
||||
meta_env_size,
|
||||
|
Loading…
Reference in New Issue
Block a user