-
Notifications
You must be signed in to change notification settings - Fork 761
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
fix: show locks in current tenant #15252
Conversation
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.
Reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @zhyass)
src/meta/app/src/schema/lock.rs
line 149 at r1 (raw file):
if self.table_ids.is_empty() { let table_lock_prefix = format!("{}/{}/", TableLockKey::PREFIX, self.tenant.tenant_name());
Do no use ::PREFIX
directly, use the structured key to build a prefix with:
let ident = TableLockKey::new(self.tenant.clone(), 0, 0);
let prefix = DirName::new_with_level(lock, 2).dir_name_with_slash();
And it is prone to bug using this method to build both two levels prefix string and one level prefix string.
There should be another method to build a one level prefix string.
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.
Reviewable status: 4 of 7 files reviewed, 1 unresolved discussion (waiting on @zhyass)
src/meta/app/src/schema/lock.rs
line 149 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
Do no use
::PREFIX
directly, use the structured key to build a prefix with:let ident = TableLockKey::new(self.tenant.clone(), 0, 0); let prefix = DirName::new_with_level(lock, 2).dir_name_with_slash();And it is prone to bug using this method to build both two levels prefix string and one level prefix string.
There should be another method to build a one level prefix string.
👆🏻This method builds two different kinds of keys. There should be two methods for two kinds of keys.
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.
Reviewed 1 of 2 files at r3, 3 of 3 files at r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @zhyass)
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @drmingdrmer)
src/meta/app/src/schema/lock.rs
line 149 at r1 (raw file):
Previously, drmingdrmer (张炎泼) wrote…
Do no use
::PREFIX
directly, use the structured key to build a prefix with:let ident = TableLockKey::new(self.tenant.clone(), 0, 0); let prefix = DirName::new_with_level(lock, 2).dir_name_with_slash();And it is prone to bug using this method to build both two levels prefix string and one level prefix string.
There should be another method to build a one level prefix string.
Done.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
Add tenant in lock key, show locks only in the current tenant.
This is an incompatible modification. It is recommended to wait for existing table locks to time out for normal upgrades (second level).
Tests
Type of change
This change is