-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storage: do not fetch all tables during every query. #1558
Conversation
I will add some unit test to ensure correctness and add more benchmark for iterator test. |
Better to add some comments in the code😊 |
rust/meta/src/hummock/mod.rs
Outdated
.table_infos | ||
.iter() | ||
.map(|sst| sst.id) | ||
.collect_vec() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to collect
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand ....
1265e6c
to
92b7e33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are get_compact_task
and report_compact_tasks
calls here proper? better ask @zwang28
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does first level have to be Overlapping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if compact task failed?
Codecov Report
@@ Coverage Diff @@
## main #1558 +/- ##
============================================
- Coverage 69.91% 69.85% -0.07%
Complexity 2766 2766
============================================
Files 1052 1052
Lines 92464 92678 +214
Branches 1790 1790
============================================
+ Hits 64650 64741 +91
- Misses 26923 27046 +123
Partials 891 891
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
I run a benchmark to test the filter effect for latency. benchmark command cargo run --release --bin ss-bench -- \
--benchmarks "writebatch,prefixscanrandom" --batch-size 100000 \
--writes 500000 \
--reads 0 \
--scans 10000 \
--deletes 0 \
--concurrency-num 1 \
--seed 233 \
--statistics --store "hummock+minio://minioadmin:[email protected]:9000/bucket" --compact-level-after-write 1 --table-size-mb=2 benchmark resultcurrent PR main Because the main branch can not run a iterator bench after compaction, I commented out some code from the current branch to replace the main branch. let mut overlapped_sstable_iters = vec![];
for level in &version.levels() {
let table_ids = level
.table_infos
.iter()
// .filter(|info| {
// let table_range = info.key_range.as_ref().unwrap();
// let table_start = user_key(table_range.left.as_slice());
// let table_end = user_key(table_range.right.as_slice());
// range_overlap(&key_range, table_start, table_end, false)
// })
.map(|info| info.id)
.collect_vec();
if table_ids.is_empty() {
continue;
}
table_count += table_ids.len();
let tables = self
.local_version_manager
.pick_few_tables(&table_ids)
.await?;
// match level.level_type() {
// LevelType::Overlapping => {
for table in tables.into_iter().rev() {
overlapped_sstable_iters.push(Box::new(SSTableIterator::new(
table,
self.sstable_store.clone(),
))
as BoxedHummockIterator);
}
// }
// LevelType::Nonoverlapping => overlapped_sstable_iters.push(Box::new(
// ConcatIterator::new(tables, self.sstable_store.clone()),
// )),
// }
} |
commit 80a66b5f81fb6c8662bcff7a792d4487d3cb7027 Author: Little-Wallace <[email protected]> Date: Thu Apr 7 18:44:41 2022 +0800 feat(frontend): show command (#1545) 1.support show command (databases, schemas, tables, mviews, columns) and describe table or source. ``` SHOW DATABASES SHOW SCHEMAS SHOW COLUMNS FROM <TABLE | SOURCE> DESCRIBE <TABLE | SOURCE> SHOW TABLES [FROM SCHEMA] SHOW MATERIALIZED VIEWS [FROM SCHEMA] ``` 2.remove show table and show source change to describe and show columns. commit 7403271 Author: zwang28 <[email protected]> Date: Thu Apr 7 11:03:44 2022 +0800 chore: fix e2e command in doc. (#1626) commit fa2bff4 Author: Alex Chi <[email protected]> Date: Thu Apr 7 10:50:02 2022 +0800 docs: add getting started guide (#1625) Signed-off-by: Alex Chi <[email protected]> Signed-off-by: Little-Wallace <[email protected]> commit 4a13f7eb21b7fd58d4bfaced84fee71fa0834a94 Author: Little-Wallace <[email protected]> Date: Thu Apr 7 16:18:19 2022 +0800 fix clippy Signed-off-by: Little-Wallace <[email protected]> commit 8d206d98e254a01e568965e6ee96f14e3f36cf42 Author: Little-Wallace <[email protected]> Date: Thu Apr 7 15:53:04 2022 +0800 add more test Signed-off-by: Little-Wallace <[email protected]> commit 4432ab7337419b4ef7dbb267f470294ab751b2a7 Author: Little-Wallace <[email protected]> Date: Thu Apr 7 14:47:17 2022 +0800 fix test Signed-off-by: Little-Wallace <[email protected]> commit cf075a762d660109797206ba52a921fa369663b7 Author: Little-Wallace <[email protected]> Date: Thu Apr 7 14:37:09 2022 +0800 tmp Signed-off-by: Little-Wallace <[email protected]> commit 949a85f026eb8a3c25584775ab39b83d05197f61 Author: Little-Wallace <[email protected]> Date: Thu Apr 7 11:50:35 2022 +0800 fix clippy Signed-off-by: Little-Wallace <[email protected]> commit 94cbe1a4f6f4e01d706e63e812460fde2e7d6b2b Author: Little-Wallace <[email protected]> Date: Thu Apr 7 11:28:53 2022 +0800 add some note Signed-off-by: Little-Wallace <[email protected]>
80a66b5
to
1e97104
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -42,6 +42,44 @@ impl MockHummockMetaClient { | |||
context_id, | |||
} | |||
} | |||
|
|||
pub async fn get_compact_task(&self, target_level: u32) -> Option<CompactTask> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a get_compact_task method in HummockManager, can it be used directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. But there is a difficult that HummockManager
trigger it automatic but i need a manual interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. But there is a difficult that
HummockManager
trigger it automatic but i need a manual interface
HummockManager::get_compact_task itself is manual and we do have a reference to hummock_manager in MockHummockMetaClient.
The automatic compact trigger will only be started along with meta node, which is not the case here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will remove it in #1694. please take a look
Signed-off-by: Little-Wallace [email protected]
What's changed and what's your intention?
close #1507
Although the meta most of tables will be cached, if there are too many files in the whole cluster , the bloom-filter-data would cost a lot of memory. In fact, most of request only concerned about a few data in a small range of the current executor , so they do not need to fetch all table from the table-cache.
Checklist
Refer to a related PR or issue link (optional)