mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 20:37:15 +02:00
fix dumpv1
This commit is contained in:
parent
44a2ff07b1
commit
03af99650d
4 changed files with 18 additions and 5 deletions
|
@ -109,6 +109,15 @@ pub fn load_dump(
|
|||
update_db_size: usize,
|
||||
indexer_opts: &IndexerOpts,
|
||||
) -> anyhow::Result<()> {
|
||||
// Setup a temp directory path in the same path as the database, to prevent cross devices
|
||||
// references.
|
||||
let temp_path = dst_path.as_ref().parent().map(ToOwned::to_owned).unwrap_or_else(|| ".".into());
|
||||
if cfg!(windows) {
|
||||
std::env::set_var("TMP", temp_path);
|
||||
} else {
|
||||
std::env::set_var("TMPDIR", temp_path);
|
||||
}
|
||||
|
||||
let tmp_src = tempfile::tempdir()?;
|
||||
let tmp_src_path = tmp_src.path();
|
||||
|
||||
|
@ -120,6 +129,8 @@ pub fn load_dump(
|
|||
|
||||
let tmp_dst = tempfile::tempdir()?;
|
||||
|
||||
println!("temp path: {}", tmp_dst.path().display());
|
||||
|
||||
match meta {
|
||||
Metadata::V1(meta) => {
|
||||
meta.load_dump(&tmp_src_path, tmp_dst.path(), index_db_size, indexer_opts)?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue