Skip to content

Commit

Permalink
chore: set file_size_hint for cached blob reader
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Dec 12, 2024
1 parent 3797f01 commit b7b91bb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/mito2/src/sst/index/inverted_index/applier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl InvertedIndexApplier {
index_not_found_strategy: IndexNotFoundStrategy::ReturnEmpty,
};

let blob = match self.cached_blob_reader(file_id).await {
let blob = match self.cached_blob_reader(file_id, file_size_hint).await {
Ok(Some(puffin_reader)) => puffin_reader,
other => {
if let Err(err) = other {
Expand Down Expand Up @@ -153,7 +153,11 @@ impl InvertedIndexApplier {
}

/// Creates a blob reader from the cached index file.
async fn cached_blob_reader(&self, file_id: FileId) -> Result<Option<BlobReader>> {
async fn cached_blob_reader(
&self,
file_id: FileId,
file_size_hint: Option<u64>,
) -> Result<Option<BlobReader>> {
let Some(file_cache) = &self.file_cache else {
return Ok(None);
};
Expand All @@ -170,6 +174,8 @@ impl InvertedIndexApplier {
.reader(&puffin_file_name)
.await
.context(PuffinBuildReaderSnafu)?
// Skips file system stat to minimize additional I/O overhead, which can take hundreds of microseconds.
.with_file_size_hint(file_size_hint)
.blob(INDEX_BLOB_TYPE)
.await
.context(PuffinReadBlobSnafu)?
Expand Down

0 comments on commit b7b91bb

Please sign in to comment.