diff --git a/CHANGELOG.md b/CHANGELOG.md index a1f8a8fe..a5411371 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,9 @@ All changes in this project will be noted in this file. save on termination routine - Fixed bug that prevented tree cleanup from working - Disallow `PRELOAD` and `PARTMAP` as entity names + - Fixed edge case where time on host is incorrect, resulting in bad snapshot names which might + ultimately lead to loss of snapshot data + - Fixed remote snapshots with same names being overwritten ## Version 0.7.4 diff --git a/server/src/storage/v1/sengine.rs b/server/src/storage/v1/sengine.rs index 53dd2f12..5767fe71 100644 --- a/server/src/storage/v1/sengine.rs +++ b/server/src/storage/v1/sengine.rs @@ -39,6 +39,7 @@ use regex::Regex; use std::collections::HashSet; use std::fs; use std::io::Error as IoError; +use std::path::Path; use std::sync::Arc; type QStore = IArray<[String; 64]>; @@ -164,9 +165,13 @@ impl SnapshotEngine { Utc::now().format("%Y%m%d-%H%M%S").to_string() } fn _mksnap_blocking_section(store: &Memstore, name: String) -> SnapshotResult<()> { - let snapshot = LocalSnapshot::new(name); - super::flush::flush_full(snapshot, store)?; - Ok(()) + if Path::new(&format!("{DIR_SNAPROOT}/{name}")).exists() { + Err(SnapshotEngineError::Engine("Server time is incorrect")) + } else { + let snapshot = LocalSnapshot::new(name); + super::flush::flush_full(snapshot, store)?; + Ok(()) + } } fn _rmksnap_blocking_section(store: &Memstore, name: &str) -> SnapshotResult<()> { let snapshot = RemoteSnapshot::new(name);