Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Store backups in separate top-level directory #2385

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shaggy-stingrays-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@farcaster/hubble": patch
---

Place backups in dedicated directory
13 changes: 6 additions & 7 deletions apps/hubble/src/addon/src/db/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ impl RocksDB {
.to_string();

let start = std::time::SystemTime::now();
info!(logger, "Creating chunked tar.gz snapshot for directory: {}",
info!(logger, "Creating chunked tar.gz snapshot for directory: {}",
input_dir; o!("output_file_path" => &chunked_output_dir, "base_name" => &base_name));

let mut multi_chunk_writer = MultiChunkWriter::new(
Expand Down Expand Up @@ -1049,12 +1049,11 @@ impl RocksDB {
let timestamp = chrono::NaiveDateTime::from_timestamp_millis(timestamp_ms)
.unwrap_or(chrono::Utc::now().naive_utc());

let main_backup_path = Path::new(&format!(
"{}-{}.backup",
main_db_path,
timestamp.format("%Y-%m-%d-%s")
))
.join("rocks.hub._default");
let main_backup_path = Path::new(&main_db_path)
.join("..") // Create backup as sibling directory of normal path
.join("backup")
.join(format!("{}.backup", timestamp.format("%Y-%m-%d-%s")))
.join("rocks.hub._default");

// rm -rf this path if it exists
if main_backup_path.exists() {
Expand Down
Loading