diff --git a/mutable_buffer/Cargo.toml b/mutable_buffer/Cargo.toml index d3e70a9b53..b37b990402 100644 --- a/mutable_buffer/Cargo.toml +++ b/mutable_buffer/Cargo.toml @@ -33,3 +33,8 @@ tracker = { path = "../tracker" } [dev-dependencies] # In alphabetical order test_helpers = { path = "../test_helpers" } criterion = "0.3" + +[features] +default = [] +# Disables snapshot caching +nocache = [] diff --git a/mutable_buffer/src/chunk.rs b/mutable_buffer/src/chunk.rs index 8ebf0a2e5d..b0fd617d4e 100644 --- a/mutable_buffer/src/chunk.rs +++ b/mutable_buffer/src/chunk.rs @@ -140,6 +140,7 @@ impl Chunk { } /// Returns a queryable snapshot of this chunk + #[cfg(not(feature = "nocache"))] pub fn snapshot(&self) -> Arc { let mut guard = self.snapshot.lock(); if let Some(snapshot) = &*guard { @@ -152,6 +153,12 @@ impl Chunk { snapshot } + /// Returns a queryable snapshot of this chunk + #[cfg(feature = "nocache")] + pub fn snapshot(&self) -> Arc { + Arc::new(ChunkSnapshot::new(self)) + } + /// returns true if there is no data in this chunk pub fn is_empty(&self) -> bool { self.tables.is_empty() diff --git a/server/Cargo.toml b/server/Cargo.toml index 663e36702c..1241dd4999 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -42,6 +42,11 @@ flate2 = "1.0.20" tempfile = "3.1.0" test_helpers = { path = "../test_helpers" } +[features] +default = [] +# Enable features for benchmarking +bench = ["mutable_buffer/nocache"] + [[bench]] name = "influxrpc" harness = false