-
Notifications
You must be signed in to change notification settings - Fork 590
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(object store): introduce object prefix for opendal object store #16542
Conversation
src/meta/src/hummock/manager/mod.rs
Outdated
if use_new_object_prefix_strategy { | ||
match env.system_params_manager_impl_ref() { | ||
SystemParamsManagerImpl::Kv(mgr) => { | ||
mgr.set_param("use_new_object_prefix_strategy", Some("true".to_owned())) | ||
.await | ||
.unwrap(); | ||
} | ||
SystemParamsManagerImpl::Sql(mgr) => { | ||
mgr.set_param("use_new_object_prefix_strategy", Some("true".to_owned())) | ||
.await | ||
.unwrap(); | ||
} | ||
}; | ||
} else { | ||
match env.system_params_manager_impl_ref() { | ||
SystemParamsManagerImpl::Kv(mgr) => { | ||
mgr.set_param("use_new_object_prefix_strategy", Some("false".to_owned())) | ||
.await | ||
.unwrap(); | ||
} | ||
SystemParamsManagerImpl::Sql(mgr) => { | ||
mgr.set_param("use_new_object_prefix_strategy", Some("false".to_owned())) | ||
.await | ||
.unwrap(); | ||
} | ||
}; | ||
} |
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 suggest we move the logic to MetaSrvEnv::new
instead here becuase:
cluster_first_launch
can be obtained directly there without interacting with object store and modifyingwrite_exclusive_cluster_id
- We can avoid making
use_new_object_prefix_strategy
mutable and instead pass the init value foruse_new_object_prefix_strategy
to init system params manager.
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.
cluster_first_launch can be obtained directly there
For KV
meta store, it is, but for SQL
meta store, can we know whether it is the first launch 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.
cc @yezizp2012 Can we also judge cluster_first_launch for SQL backend, just like KV backend?
Otherwise we need to modify this system variable later, but "Making the use_new_object_prefix_strategy mutable will be dangerous because user can techinically change it via ALTER in SQL and the after a restart, the whole cluster will crash."
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.
After some offline discussion, for SQL backend I use MigratorTrait::get_applied_migrations()
to check whether it's a new cluster:
- if
m20230908_072257_init
is applied, it's an old cluster - if
m20230908_072257_init
is not applied, it's a new cluster.
Then we can make use_new_object_prefix_strategy
immutable.
src/meta/src/manager/env.rs
Outdated
@@ -416,11 +417,25 @@ impl MetaSrvEnv { | |||
.await? | |||
.map(|c| c.cluster_id.to_string().into()) | |||
.unwrap(); | |||
let migrations = Migrator::get_applied_migrations(&sql_meta_store.conn).await?; | |||
let mut cluster_first_launch = true; |
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.
@yezizp2012 PTAL for this part, thanks!
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.
We should check the status before calling Migrator::up
. At this point all migrations has already been applied. Please add a helper function to get whether the cluster is first launched, together with some necessary comments.
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.
We should check the status before calling
Migrator::up
. At this point all migrations has already been applied. Please add a helper function to get whether the cluster is first launched, together with some necessary comments.
+1. If we check get_applied_migrations
here, it will contain "m20230908_072257_init" for sure.
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, and since we explicitly specify that use_new_prefix_strategy
should be passed in, there is no need to make any further judgment for ctl, right?
src/meta/src/manager/env.rs
Outdated
@@ -416,11 +417,25 @@ impl MetaSrvEnv { | |||
.await? | |||
.map(|c| c.cluster_id.to_string().into()) | |||
.unwrap(); | |||
let migrations = Migrator::get_applied_migrations(&sql_meta_store.conn).await?; | |||
let mut cluster_first_launch = true; |
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.
We should check the status before calling
Migrator::up
. At this point all migrations has already been applied. Please add a helper function to get whether the cluster is first launched, together with some necessary comments.
+1. If we check get_applied_migrations
here, it will contain "m20230908_072257_init" for sure.
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. Thanks for the PR!
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
9425213 | Triggered | Generic Password | 6de4852 | ci/scripts/e2e-sink-test.sh | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
@@ -408,13 +407,6 @@ pub async fn start_service_as_election_leader( | |||
mut svc_shutdown_rx: WatchReceiver<()>, | |||
) -> MetaResult<()> { | |||
tracing::info!("Defining leader services"); | |||
if let MetaStoreImpl::Sql(sql_store) = &meta_store_impl { |
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 remove this code ?
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR introduce a new system params
use_new_object_prefix_strategy
to control whether split object prefix. In general,use_new_object_prefix_strategy
is set to true and all opendal object store will split prefix;use_new_object_prefix_strategy
is set to false and everything keep the same with before.Thus, we can guarantee backward compatibility.
Once an origin customer find some issue with the performance and want to split prefix for his old cluster, it's required to execute a script to completely rename the data in the object store and modify the system params in some way.
So in a word, this pr will not affect the behavior of an already exist cluster.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.