fix: Warn when a non-generation item is found in a database directory

pull/24376/head
Carol (Nichols || Goulding) 2021-08-26 09:11:21 -04:00
parent 7cf7fb02ed
commit 82b566a3bb
3 changed files with 7 additions and 2 deletions

1
Cargo.lock generated
View File

@ -1925,6 +1925,7 @@ dependencies = [
"data_types",
"futures",
"object_store",
"observability_deps",
"snafu",
"tokio",
"tokio-stream",

View File

@ -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"

View File

@ -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);
}
}