|
|
@ -102,7 +102,6 @@ impl BackupEngine { |
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
|
|
|
|
|
|
|
|
pub fn restore_from_latest_backup<D: AsRef<Path>, W: AsRef<Path>>( |
|
|
|
pub fn restore_from_latest_backup<D: AsRef<Path>, W: AsRef<Path>>( |
|
|
|
|
|
|
|
|
|
|
|
&mut self, |
|
|
|
&mut self, |
|
|
|
db_dir: D, |
|
|
|
db_dir: D, |
|
|
|
wal_dir: W, |
|
|
|
wal_dir: W, |
|
|
@ -206,7 +205,6 @@ impl Drop for RestoreOptions { |
|
|
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
#[test] |
|
|
|
fn backup_restore() { |
|
|
|
fn backup_restore() { |
|
|
|
|
|
|
|
|
|
|
|
use db::DBVector; |
|
|
|
use db::DBVector; |
|
|
|
// create backup
|
|
|
|
// create backup
|
|
|
|
let path = "_rust_rocksdb_backup_restore_test"; |
|
|
|
let path = "_rust_rocksdb_backup_restore_test"; |
|
|
@ -229,7 +227,11 @@ fn backup_restore() { |
|
|
|
{ |
|
|
|
{ |
|
|
|
let mut restore_option = RestoreOptions::default(); |
|
|
|
let mut restore_option = RestoreOptions::default(); |
|
|
|
restore_option.set_keep_log_files(true); // true to keep log files
|
|
|
|
restore_option.set_keep_log_files(true); // true to keep log files
|
|
|
|
let restore_status = backup_engine.restore_from_latest_backup(&restore_path, &restore_path, &restore_option); |
|
|
|
let restore_status = backup_engine.restore_from_latest_backup( |
|
|
|
|
|
|
|
&restore_path, |
|
|
|
|
|
|
|
&restore_path, |
|
|
|
|
|
|
|
&restore_option, |
|
|
|
|
|
|
|
); |
|
|
|
assert!(restore_status.is_ok()); |
|
|
|
assert!(restore_status.is_ok()); |
|
|
|
|
|
|
|
|
|
|
|
let db = DB::open_default(restore_path).unwrap(); |
|
|
|
let db = DB::open_default(restore_path).unwrap(); |
|
|
@ -239,6 +241,4 @@ fn backup_restore() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|