Skip to content

Commit

Permalink
refactor: move last cache to influxdb3_cache crate (influxdata#25620)
Browse files Browse the repository at this point in the history
Moved all of the last cache implementation into the `influxdb3_cache`
crate. This also splits out the implementation into three modules:
- `cache.rs`: the core cache implementation
- `provider.rs`: the cache provider used by the database to hold multiple
  caches.
- `table_function.rs`: same as before, holds the DataFusion impls

Tests were preserved and moved to `mod.rs`, however, they were updated to
not rely on the WriteBuffer implementation, and instead use the types in
the `influxdb3_cache::last_cache` module directly. This simplified the
test code, while not changing any of the test assertions at all.
  • Loading branch information
hiltontj authored Dec 5, 2024
1 parent 7211e8a commit 9b87cd7
Show file tree
Hide file tree
Showing 22 changed files with 3,248 additions and 3,534 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions influxdb3/src/commands/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use clap_blocks::{
tokio::TokioDatafusionConfig,
};
use datafusion_util::config::register_iox_object_store;
use influxdb3_cache::meta_cache::MetaCacheProvider;
use influxdb3_cache::{
last_cache::{self, LastCacheProvider},
meta_cache::MetaCacheProvider,
};
use influxdb3_process::{
build_malloc_conf, setup_metric_registry, INFLUXDB3_GIT_HASH, INFLUXDB3_VERSION, PROCESS_UUID,
};
Expand All @@ -22,7 +25,6 @@ use influxdb3_sys_events::SysEventStore;
use influxdb3_telemetry::store::TelemetryStore;
use influxdb3_wal::{Gen1Duration, WalConfig};
use influxdb3_write::{
last_cache::LastCacheProvider,
parquet_cache::create_cached_obj_store_and_oracle,
persister::Persister,
write_buffer::{persisted_files::PersistedFiles, WriteBufferImpl, WriteBufferImplArgs},
Expand Down Expand Up @@ -80,7 +82,7 @@ pub enum Error {
InitializePersistedCatalog(#[source] influxdb3_write::persister::Error),

#[error("failed to initialize last cache: {0}")]
InitializeLastCache(#[source] influxdb3_write::last_cache::Error),
InitializeLastCache(#[source] last_cache::Error),

#[error("failed to initialize meta cache: {0:#}")]
InitializeMetaCache(#[source] influxdb3_cache::meta_cache::ProviderError),
Expand Down
11 changes: 11 additions & 0 deletions influxdb3_cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license.workspace = true
[dependencies]
# Core Crates
iox_time.workspace = true
observability_deps.workspace = true
schema.workspace = true

# Local deps
Expand All @@ -27,8 +28,18 @@ thiserror.workspace = true
tokio.workspace = true

[dev-dependencies]
# core deps
arrow_util.workspace = true
data_types.workspace = true

# Local deps
influxdb3_write = { path = "../influxdb3_write" }

# crates.io deps
bimap.workspace = true
insta.workspace = true
object_store.workspace = true
test-log.workspace = true

[lints]
workspace = true
Loading

0 comments on commit 9b87cd7

Please sign in to comment.