Skip to content

Commit 171e2f6

Browse files
committed
feat: distinguish intermediate store and index store
Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
1 parent 45f917b commit 171e2f6

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/mito2/src/sst/index/creator.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub struct SstIndexCreator {
5959
/// ID of the SST file.
6060
sst_file_id: FileId,
6161

62-
/// The store to write intermediate files and index files.
62+
/// The store to write index files.
6363
store: InstrumentedStore,
6464
/// The index creator.
6565
index_creator: Box<dyn InvertedIndexCreator>,
@@ -84,20 +84,19 @@ impl SstIndexCreator {
8484
region_dir: String,
8585
sst_file_id: FileId,
8686
metadata: &RegionMetadataRef,
87-
object_store: ObjectStore,
87+
index_store: ObjectStore,
88+
intermediate_store: ObjectStore, // prefer to use local store
8889
memory_usage_threshold: Option<usize>,
8990
row_group_size: NonZeroUsize,
9091
) -> Self {
91-
let store = InstrumentedStore::new(object_store);
92-
9392
// `memory_usage_threshold` is the total memory usage threshold of the index creation,
9493
// so we need to divide it by the number of columns
9594
let memory_threshold = memory_usage_threshold.map(|threshold| {
9695
(threshold / metadata.primary_key.len()).max(MIN_MEMORY_USAGE_THRESHOLD)
9796
});
9897
let temp_file_provider = Arc::new(TempFileProvider::new(
9998
IntermediateLocation::new(&region_dir, &sst_file_id),
100-
store.clone(),
99+
InstrumentedStore::new(intermediate_store),
101100
));
102101
let sorter = ExternalSorter::factory(temp_file_provider.clone() as _, memory_threshold);
103102
let index_creator = Box::new(SortIndexCreator::new(sorter, row_group_size));
@@ -106,7 +105,7 @@ impl SstIndexCreator {
106105
Self {
107106
region_dir,
108107
sst_file_id,
109-
store,
108+
store: InstrumentedStore::new(index_store),
110109
codec,
111110
index_creator,
112111
temp_file_provider,

0 commit comments

Comments
 (0)