Skip to content

Commit

Permalink
force refill whole unit
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx committed Oct 11, 2023
1 parent 73fa33d commit 1312ee8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion src/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/storage/src/hummock/event_handler/refiller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/storage/src/hummock/file_cache/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool> {
match self {
FileCacheWriter::Foyer { writer } => writer.finish(value).await,
Expand Down

0 comments on commit 1312ee8

Please sign in to comment.