Skip to content

Commit

Permalink
chore: set prefetch size to 64KiB
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Dec 12, 2024
1 parent 2d34e58 commit 6663855
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/index/src/inverted_index/format/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::sync::Arc;

use async_trait::async_trait;
use common_base::BitVec;
use common_telemetry::debug;
use greptime_proto::v1::index::InvertedIndexMetas;
use snafu::ResultExt;

Expand All @@ -38,6 +39,7 @@ pub trait InvertedIndexReader: Send {

/// Retrieves the finite state transducer (FST) map from the given offset and size.
async fn fst(&mut self, offset: u64, size: u32) -> Result<FstMap> {
debug!("using InvertedIndexReader, fst offset: {offset}, size: {size}");
let fst_data = self.range_read(offset, size).await?;
FstMap::new(fst_data).context(DecodeFstSnafu)
}
Expand Down
2 changes: 1 addition & 1 deletion src/index/src/inverted_index/format/reader/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use crate::inverted_index::error::{
};
use crate::inverted_index::format::FOOTER_PAYLOAD_SIZE_SIZE;

pub const DEFAULT_PREFETCH_SIZE: u64 = 1024; // 1KiB
pub const DEFAULT_PREFETCH_SIZE: u64 = 64 * 1024; // 64KiB

/// InvertedIndexFooterReader is for reading the footer section of the blob.
pub struct InvertedIndexFooterReader<R> {
Expand Down
3 changes: 2 additions & 1 deletion src/mito2/src/cache/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::sync::Arc;
use api::v1::index::InvertedIndexMetas;
use async_trait::async_trait;
use common_base::BitVec;
use common_telemetry::tracing;
use common_telemetry::{debug, tracing};
use index::inverted_index::error::DecodeFstSnafu;
use index::inverted_index::format::reader::InvertedIndexReader;
use index::inverted_index::FstMap;
Expand Down Expand Up @@ -134,6 +134,7 @@ impl<R: InvertedIndexReader> InvertedIndexReader for CachedInvertedIndexBlobRead
offset: u64,
size: u32,
) -> index::inverted_index::error::Result<FstMap> {
debug!("using CachedInvertedIndexBlobReader, fst offset: {offset}, size: {size}");
self.get_or_load(offset, size)
.await
.and_then(|r| FstMap::new(r).context(DecodeFstSnafu))
Expand Down
3 changes: 2 additions & 1 deletion src/mito2/src/sst/index/inverted_index/applier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod builder;

use std::sync::Arc;

use common_telemetry::warn;
use common_telemetry::{debug, warn};
use index::inverted_index::format::reader::InvertedIndexBlobReader;
use index::inverted_index::search::index_apply::{
ApplyOutput, IndexApplier, IndexNotFoundStrategy, SearchContext,
Expand Down Expand Up @@ -134,6 +134,7 @@ impl InvertedIndexApplier {
};

if let Some(index_cache) = &self.inverted_index_cache {
debug!("inverted index cache is used");
let mut index_reader = CachedInvertedIndexBlobReader::new(
file_id,
InvertedIndexBlobReader::new(blob),
Expand Down
2 changes: 1 addition & 1 deletion src/puffin/src/file_format/reader/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::file_format::{Flags, FLAGS_SIZE, MAGIC, MAGIC_SIZE, MIN_FILE_SIZE, PA
use crate::file_metadata::FileMetadata;

/// The default prefetch size for the footer reader.
pub const DEFAULT_PREFETCH_SIZE: u64 = 1024; // 1KiB
pub const DEFAULT_PREFETCH_SIZE: u64 = 64 * 1024; // 64KiB

/// Reader for the footer of a Puffin data file
///
Expand Down

0 comments on commit 6663855

Please sign in to comment.