-
Notifications
You must be signed in to change notification settings - Fork 526
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
feat(storage): enable static compaction group #3453
Conversation
1176775
to
93a7d7b
Compare
93a7d7b
to
90d191c
Compare
Codecov Report
@@ Coverage Diff @@
## main #3453 +/- ##
==========================================
+ Coverage 74.29% 74.31% +0.01%
==========================================
Files 773 773
Lines 109551 109868 +317
==========================================
+ Hits 81391 81646 +255
- Misses 28160 28222 +62
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 |
/// Tries to get from local cache | ||
pub async fn try_get_compaction_group_id(&self, prefix: Prefix) -> Option<CompactionGroupId> { | ||
async fn try_get_compaction_group_id(&self, prefix: Prefix) -> Option<CompactionGroupId> { |
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.
Do not async RwLock
because any RPC request will block other read request.
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.
suggest parking_lot::RwLock
to reduce lock wait.
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.
let mut guard = self.inner.read();
if let Some(compaction_group_id) = guard.get(&prefix) {
return Ok(Some(compaction_group_id));
}
drop(guard);
let compaction_groups = self
.hummock_meta_client
.get_compaction_groups()
.await
.map_err(HummockError::meta_error)?;
let mut guard = self.inner.write();
guard.set_index(compaction_groups);
Ok(guard.get(&prefix))
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.
Then we also need to avoid duplicate RPCs. It's doable.
I used the current approach because I think cache update is rare, which is only required when new table is created.
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.
need to avoid duplicate RPCs
in this case get_compaction_groups is a read operation , why we need to avoid duplicate RPCs (to reduce read rpc ?)
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. This RPC is light and cost little CPU of meta-service. So we do not need to avoid duplicate RPCs
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.
fixed
# Conflicts: # src/meta/src/hummock/compaction_group/manager.rs
…uld not be unregistered from compaction group.
# Conflicts: # src/meta/src/stream/source_manager.rs # src/storage/src/hummock/compactor_tests.rs
# Conflicts: # src/storage/src/hummock/state_store.rs
#[async_trait::async_trait] | ||
impl CompactionGroupClient for CompactionGroupClientImpl { | ||
/// Tries to get from local cache first,then from meta service | ||
async fn get_compaction_group_id( |
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.
If shared buffer is already split by compaction group, I have a feeling that we will need to know more than just a compaction group id, for example, the compaction group configuration.
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 think so, hope that CompactionGroupClient
can fetch more info when rpc, (link configuration) , in order to support ttl and so on
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.
The complete compaction group info is already given to CompactionGroupClient, but CompactionGroupClient only store part of it for now.
I think you can modify it as need later @Li0k .
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.
All my comments are concerns on future PRs and not related to "static" compaction group. You can merge this PR first if you want.
# Conflicts: # src/storage/src/hummock/local_version_manager.rs
@Little-Wallace suggests to update CN's table->group mapping in a more timely manner, rather than current lazy manner. It makes sense to me. For example, we can update this mapping in CN when CN is process conf change barrier. Also there is an unstable failure parallel e2e test in main. Would only merge this PR after it has been fixed. |
|
|
040f551
to
cab82cb
Compare
# Conflicts: # src/meta/src/hummock/hummock_manager.rs # src/storage/hummock_sdk/src/compaction_group/hummock_version_ext.rs
c0d5fbd
to
1859a3d
Compare
A summary of changes since last review @Li0k @Little-Wallace @hzxa21 :
|
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.
Thanks for the PR. LGTM!
# Conflicts: # src/ctl/src/cmd_impl/hummock/sst_dump.rs # src/meta/src/hummock/compaction_group/manager.rs # src/meta/src/hummock/compaction_group/mod.rs # src/storage/src/hummock/compactor_tests.rs # src/storage/src/hummock/state_store.rs
self.compaction_group_manager | ||
.register_table_fragments(&table_fragments, &table_properties) | ||
.await?; | ||
|
||
// In the second stage, each [`WorkerNode`] builds local actors and connect them with | ||
// channels. | ||
for (node_id, actors) in node_actors { |
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.
Do we need to unregister_table_fragments
if BuildActorsRequest fails?
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.
purge_stale_members
ensures stale data is eventually cleaned up on each restart.
We can unregister_table_fragments/unregister_source explicitly to clean up more timely. I didn't have it here, in order to avoid introducing more error handling code here.
Let me add it.
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.
fixed
# Conflicts: # src/workspace-hack/Cargo.toml
I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.
What's changed and what's your intention?
Checklist
./risedev check
(or alias,./risedev c
)Refer to a related PR or issue link (optional)
#2065