Use fs::rename which is much faster than move_items (#8579) (#8594)

automerge
This commit is contained in:
mergify[bot]
2020-03-03 10:54:36 -08:00
committed by GitHub
parent 4398628265
commit d0de1c913a

View File

@ -528,6 +528,8 @@ impl AccountsDB {
AppendVec::new_relative_path(slot_id, storage_entry.id);
let append_vec_abs_path =
append_vecs_path.as_ref().join(&append_vec_relative_path);
let target = local_dir.join(append_vec_abs_path.file_name().unwrap());
if std::fs::rename(append_vec_abs_path.clone(), target).is_err() {
let mut copy_options = CopyOptions::new();
copy_options.overwrite = true;
let e = fs_extra::move_items(
@ -545,6 +547,7 @@ impl AccountsDB {
info!("{:?}", e);
continue;
}
};
// Notify the AppendVec of the new file location
let local_path = local_dir.join(append_vec_relative_path);