From 82b566a3bbeaa4280bc682d9ac87f559e6577736 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 26 Aug 2021 09:11:21 -0400 Subject: [PATCH] fix: Warn when a non-generation item is found in a database directory --- Cargo.lock | 1 + iox_object_store/Cargo.toml | 1 + iox_object_store/src/lib.rs | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 62068f6a87..da0f7b444a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1925,6 +1925,7 @@ dependencies = [ "data_types", "futures", "object_store", + "observability_deps", "snafu", "tokio", "tokio-stream", diff --git a/iox_object_store/Cargo.toml b/iox_object_store/Cargo.toml index f8c4005693..e53e4874e6 100644 --- a/iox_object_store/Cargo.toml +++ b/iox_object_store/Cargo.toml @@ -9,6 +9,7 @@ bytes = "1.0" data_types = { path = "../data_types" } futures = "0.3" object_store = { path = "../object_store" } +observability_deps = { path = "../observability_deps" } snafu = "0.6" tokio = { version = "1.0", features = ["macros", "time"] } tokio-stream = "0.1" diff --git a/iox_object_store/src/lib.rs b/iox_object_store/src/lib.rs index 262db59486..0bdfe5aa43 100644 --- a/iox_object_store/src/lib.rs +++ b/iox_object_store/src/lib.rs @@ -24,6 +24,7 @@ use object_store::{ path::{parsed::DirsAndFileName, ObjectStorePath, Path}, ObjectStore, ObjectStoreApi, Result, }; +use observability_deps::tracing::warn; use snafu::{ensure, ResultExt, Snafu}; use std::{io, sync::Arc}; use tokio::sync::mpsc::channel; @@ -131,8 +132,6 @@ impl IoxObjectStore { .last() .expect("path can't be empty"); - // Deliberately ignoring errors with parsing; if the directory isn't a usize, it's - // not a valid database generation directory and we should skip it. if let Ok(id) = id.to_string().parse() { // TODO: Check for tombstone file once we add a way to create the tombstone file // However, if we can't list the contents of a database directory, we can't @@ -145,6 +144,10 @@ impl IoxObjectStore { // .any(|object| object.location == prefix); generations.push(Generation::new(id)); + } else { + // Deliberately ignoring errors with parsing; if the directory isn't a usize, it's + // not a valid database generation directory and we should skip it. + warn!("invalid generation directory found: {}", id); } }