Skip to content

Commit

Permalink
Add user facing logs for collection snapshot (qdrant#1369)
Browse files Browse the repository at this point in the history
  • Loading branch information
agourlay authored and generall committed Feb 6, 2023
1 parent fc94d57 commit 6c02ec2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/collection/src/collection.rs
Original file line number Diff line number Diff line change
@@ -1281,11 +1281,15 @@ impl Collection {
chrono::Utc::now().format("%Y-%m-%d-%H-%M-%S")
);
let snapshot_path = self.snapshots_path.join(&snapshot_name);

log::info!(
"Creating collection snapshot {} into {:?}",
snapshot_name,
snapshot_path
);
let snapshot_path_tmp = snapshot_path.with_extension("tmp");

let snapshot_path_with_tmp_extension = temp_dir.join(&snapshot_name).with_extension("tmp");
let snapshot_path_with_arc_extension = temp_dir.join(snapshot_name).with_extension("arc");
let snapshot_path_with_arc_extension = temp_dir.join(&snapshot_name).with_extension("arc");

create_dir_all(&snapshot_path_with_tmp_extension).await?;

@@ -1308,6 +1312,7 @@ impl Collection {

let snapshot_path_with_arc_extension_clone = snapshot_path_with_arc_extension.clone();
let snapshot_path_with_tmp_extension_clone = snapshot_path_with_tmp_extension.clone();
log::debug!("Archiving snapshot {:?}", snapshot_path_with_tmp_extension);
let archiving = tokio::task::spawn_blocking(move || {
// have to use std here, cause TarBuilder is not async
let file = std::fs::File::create(&snapshot_path_with_arc_extension_clone)?;
@@ -1330,6 +1335,11 @@ impl Collection {
rename(&snapshot_path_tmp, &snapshot_path).await?;
remove_file(snapshot_path_with_arc_extension).await?;

log::info!(
"Collection snapshot {} completed into {:?}",
snapshot_name,
snapshot_path
);
get_snapshot_description(&snapshot_path).await
}

0 comments on commit 6c02ec2

Please sign in to comment.