Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade foyer with the new in-memory cache framework #19215

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 32 additions & 28 deletions Cargo.lock

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

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ license = "Apache-2.0"
repository = "https://github.com/risingwavelabs/risingwave"

[workspace.dependencies]
foyer = { version = "0.12.2", features = ["tracing", "nightly"] }
# foyer = { version = "0.12.2", features = ["tracing", "nightly"] }
foyer = { git = "https://github.com/mrcroxx/foyer", rev = "dfc8db754b93afbc19fcc2251ac5ba598bce1eec", features = [
"tracing",
"nightly",
] }
apache-avro = { git = "https://github.com/risingwavelabs/avro", rev = "25113ba88234a9ae23296e981d8302c290fdaa4b", features = [
"snappy",
"zstandard",
Expand Down
4 changes: 2 additions & 2 deletions src/batch/src/executor/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ mod tests {
use std::ops::Bound;

use assert_matches::assert_matches;
use foyer::CacheContext;
use foyer::CacheHint;
use futures::StreamExt;
use risingwave_common::array::{Array, ArrayImpl, I32Array, StructArray};
use risingwave_common::catalog::{
Expand Down Expand Up @@ -399,7 +399,7 @@ mod tests {
epoch,
None,
ReadOptions {
cache_policy: CachePolicy::Fill(CacheContext::Default),
cache_policy: CachePolicy::Fill(CacheHint::Normal),
..Default::default()
},
)
Expand Down
2 changes: 1 addition & 1 deletion src/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ itertools = { workspace = true }
libc = "0.2"
lz4 = "1.28.0"
memcomparable = "0.2"
metrics-prometheus = "0.7"
metrics-prometheus = "0.8"
moka = { version = "0.12.0", features = ["future", "sync"] }
more-asserts = "0.3"
num-integer = "0.1"
Expand Down
4 changes: 0 additions & 4 deletions src/storage/benches/bench_block_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ impl FoyerCache {
.with_eviction_config(foyer::LruConfig {
high_priority_pool_ratio: 0.8,
})
.with_object_pool_capacity(8 * 1024)
.build();
Self {
inner,
Expand All @@ -147,7 +146,6 @@ impl FoyerCache {
cmsketch_eps: 0.001,
cmsketch_confidence: 0.9,
})
.with_object_pool_capacity(8 * 1024)
.build();
Self {
inner,
Expand Down Expand Up @@ -187,7 +185,6 @@ impl FoyerHybridCache {
.with_eviction_config(foyer::LruConfig {
high_priority_pool_ratio: 0.8,
})
.with_object_pool_capacity(8 * 1024)
.storage(Engine::Large)
.build()
.await
Expand All @@ -208,7 +205,6 @@ impl FoyerHybridCache {
cmsketch_eps: 0.001,
cmsketch_confidence: 0.9,
})
.with_object_pool_capacity(8 * 1024)
.storage(Engine::Large)
.build()
.await
Expand Down
10 changes: 5 additions & 5 deletions src/storage/benches/bench_compactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::sync::Arc;

use criterion::async_executor::FuturesExecutor;
use criterion::{criterion_group, criterion_main, Criterion};
use foyer::{CacheContext, Engine, HybridCacheBuilder};
use foyer::{CacheHint, Engine, HybridCacheBuilder};
use risingwave_common::catalog::{ColumnDesc, ColumnId, TableId};
use risingwave_common::config::{MetricLevel, ObjectStoreConfig};
use risingwave_common::hash::VirtualNode;
Expand Down Expand Up @@ -95,7 +95,7 @@ pub fn default_writer_opts() -> SstableWriterOptions {
SstableWriterOptions {
capacity_hint: None,
tracker: None,
policy: CachePolicy::Fill(CacheContext::Default),
policy: CachePolicy::Fill(CacheHint::Normal),
}
}

Expand Down Expand Up @@ -132,7 +132,7 @@ async fn build_table(
SstableWriterOptions {
capacity_hint: None,
tracker: None,
policy: CachePolicy::Fill(CacheContext::Default),
policy: CachePolicy::Fill(CacheHint::Normal),
},
);
let table_id_to_vnode = HashMap::from_iter(vec![(0, VirtualNode::COUNT_FOR_TEST)]);
Expand Down Expand Up @@ -181,7 +181,7 @@ async fn build_table_2(
SstableWriterOptions {
capacity_hint: None,
tracker: None,
policy: CachePolicy::Fill(CacheContext::Default),
policy: CachePolicy::Fill(CacheHint::Normal),
},
);

Expand Down Expand Up @@ -345,7 +345,7 @@ fn bench_merge_iterator_compactor(c: &mut Criterion) {
});
let level2 = vec![info1, info2];
let read_options = Arc::new(SstableIteratorReadOptions {
cache_policy: CachePolicy::Fill(CacheContext::Default),
cache_policy: CachePolicy::Fill(CacheHint::Normal),
prefetch_for_large_query: false,
must_iterated_end_user_key: None,
max_preload_retry_times: 0,
Expand Down
4 changes: 2 additions & 2 deletions src/storage/hummock_test/benches/bench_hummock_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::Arc;

use bytes::Bytes;
use criterion::{criterion_group, criterion_main, Criterion};
use foyer::CacheContext;
use foyer::CacheHint;
use futures::pin_mut;
use risingwave_common::util::epoch::test_epoch;
use risingwave_hummock_sdk::key::TableKey;
Expand Down Expand Up @@ -109,7 +109,7 @@ fn criterion_benchmark(c: &mut Criterion) {
epoch,
ReadOptions {
prefetch_options: PrefetchOptions::default(),
cache_policy: CachePolicy::Fill(CacheContext::Default),
cache_policy: CachePolicy::Fill(CacheHint::Normal),
..Default::default()
},
))
Expand Down
10 changes: 5 additions & 5 deletions src/storage/hummock_test/src/compactor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) mod tests {
use std::sync::Arc;

use bytes::{BufMut, Bytes, BytesMut};
use foyer::CacheContext;
use foyer::CacheHint;
use itertools::Itertools;
use rand::{Rng, RngCore, SeedableRng};
use risingwave_common::bitmap::BitmapBuilder;
Expand Down Expand Up @@ -338,7 +338,7 @@ pub(crate) mod tests {
TableKey(key.clone()),
get_epoch,
ReadOptions {
cache_policy: CachePolicy::Fill(CacheContext::Default),
cache_policy: CachePolicy::Fill(CacheHint::Normal),
..Default::default()
},
)
Expand Down Expand Up @@ -668,7 +668,7 @@ pub(crate) mod tests {
ReadOptions {
table_id: TableId::from(existing_table_id),
prefetch_options: PrefetchOptions::default(),
cache_policy: CachePolicy::Fill(CacheContext::Default),
cache_policy: CachePolicy::Fill(CacheHint::Normal),
..Default::default()
},
)
Expand Down Expand Up @@ -867,7 +867,7 @@ pub(crate) mod tests {
ReadOptions {
table_id: TableId::from(existing_table_id),
prefetch_options: PrefetchOptions::default(),
cache_policy: CachePolicy::Fill(CacheContext::Default),
cache_policy: CachePolicy::Fill(CacheHint::Normal),
..Default::default()
},
)
Expand Down Expand Up @@ -1073,7 +1073,7 @@ pub(crate) mod tests {
prefix_hint: Some(Bytes::from(bloom_filter_key)),
table_id: TableId::from(existing_table_id),
prefetch_options: PrefetchOptions::default(),
cache_policy: CachePolicy::Fill(CacheContext::Default),
cache_policy: CachePolicy::Fill(CacheHint::Normal),
..Default::default()
},
)
Expand Down
Loading
Loading