diff --git a/Cargo.lock b/Cargo.lock index 446f297c83396..663cf2c247dac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3013,7 +3013,7 @@ dependencies = [ [[package]] name = "foyer" version = "0.1.0" -source = "git+https://github.com/mrcroxx/foyer?rev=f097abe#f097abed38e4363a6f2310760e304577c13cd68a" +source = "git+https://github.com/mrcroxx/foyer?rev=438eec8#438eec87e90c7a80cb53a06b711c6ea1ad7a0f41" dependencies = [ "foyer-common", "foyer-intrusive", @@ -3024,7 +3024,7 @@ dependencies = [ [[package]] name = "foyer-common" version = "0.1.0" -source = "git+https://github.com/mrcroxx/foyer?rev=f097abe#f097abed38e4363a6f2310760e304577c13cd68a" +source = "git+https://github.com/mrcroxx/foyer?rev=438eec8#438eec87e90c7a80cb53a06b711c6ea1ad7a0f41" dependencies = [ "bytes", "foyer-workspace-hack", @@ -3038,7 +3038,7 @@ dependencies = [ [[package]] name = "foyer-intrusive" version = "0.1.0" -source = "git+https://github.com/mrcroxx/foyer?rev=f097abe#f097abed38e4363a6f2310760e304577c13cd68a" +source = "git+https://github.com/mrcroxx/foyer?rev=438eec8#438eec87e90c7a80cb53a06b711c6ea1ad7a0f41" dependencies = [ "bytes", "cmsketch", @@ -3055,7 +3055,7 @@ dependencies = [ [[package]] name = "foyer-storage" version = "0.1.0" -source = "git+https://github.com/mrcroxx/foyer?rev=f097abe#f097abed38e4363a6f2310760e304577c13cd68a" +source = "git+https://github.com/mrcroxx/foyer?rev=438eec8#438eec87e90c7a80cb53a06b711c6ea1ad7a0f41" dependencies = [ "anyhow", "async-channel", @@ -3084,7 +3084,7 @@ dependencies = [ [[package]] name = "foyer-workspace-hack" version = "0.1.0" -source = "git+https://github.com/mrcroxx/foyer?rev=f097abe#f097abed38e4363a6f2310760e304577c13cd68a" +source = "git+https://github.com/mrcroxx/foyer?rev=438eec8#438eec87e90c7a80cb53a06b711c6ea1ad7a0f41" dependencies = [ "crossbeam-utils", "either", diff --git a/src/storage/Cargo.toml b/src/storage/Cargo.toml index 41ecd14c0c46e..49c1977c0f034 100644 --- a/src/storage/Cargo.toml +++ b/src/storage/Cargo.toml @@ -26,7 +26,7 @@ dyn-clone = "1.0.14" either = "1" enum-as-inner = "0.6" fail = "0.5" -foyer = { git = "https://github.com/mrcroxx/foyer", rev = "f097abe" } +foyer = { git = "https://github.com/mrcroxx/foyer", rev = "438eec8" } futures = { version = "0.3", default-features = false, features = ["alloc"] } futures-async-stream = { workspace = true } hex = "0.4" diff --git a/src/storage/src/hummock/event_handler/refiller.rs b/src/storage/src/hummock/event_handler/refiller.rs index 346df99149f9c..e9eabb952d2d2 100644 --- a/src/storage/src/hummock/event_handler/refiller.rs +++ b/src/storage/src/hummock/event_handler/refiller.rs @@ -416,7 +416,7 @@ impl CacheRefillTask { .read(&sstable_store.get_sst_data_path(object_id), range.clone()) .await?; let mut futures = vec![]; - for (writer, r) in writers.into_iter().zip_eq_fast(ranges) { + for (mut writer, r) in writers.into_iter().zip_eq_fast(ranges) { let offset = r.start - range.start; let len = r.end - r.start; let bytes = data.slice(offset..offset + len); @@ -427,6 +427,7 @@ impl CacheRefillTask { writer.weight() - writer.key().serialized_len(), )?; let block = Box::new(block); + writer.force(); let res = writer.finish(block).await.map_err(HummockError::file_cache); if matches!(res, Ok(true)) { GLOBAL_CACHE_REFILL_METRICS diff --git a/src/storage/src/hummock/file_cache/store.rs b/src/storage/src/hummock/file_cache/store.rs index 6965228f9b921..9de54552ae077 100644 --- a/src/storage/src/hummock/file_cache/store.rs +++ b/src/storage/src/hummock/file_cache/store.rs @@ -169,6 +169,13 @@ where } } + fn force(&mut self) { + match self { + FileCacheWriter::Foyer { writer } => writer.force(), + FileCacheWriter::None { writer } => writer.force(), + } + } + async fn finish(self, value: Self::Value) -> FileCacheResult { match self { FileCacheWriter::Foyer { writer } => writer.finish(value).await,