mirror of
				https://github.com/meilisearch/meilisearch.git
				synced 2025-11-04 09:56:28 +00:00 
			
		
		
		
	Make v4::load_dump copy each part a the dump
This commit is contained in:
		@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user