ch-tools
ch-tools copied to clipboard
[Do not merge] Prototype for detection of zero copy locks
The prototype script that should detect dead zero copy locks. Probably will be never merged but lets keep it anyway, may be one day will be useful
Summary by Sourcery
Introduce a prototype tool to detect dead zero-copy locks in Zookeeper by adding a scanning function and exposing it via a new CLI command
New Features:
- Add a prototype find_dead_zc_locks function to traverse zero-copy lock paths in Zookeeper and print locks missing the specified host
- Expose the detection logic through a new find-dead-zero-copy-locks command in the CLI
Reviewer's Guide
Introduces a prototype mechanism to scan Zookeeper’s zero-copy lock hierarchy and identify locks with no matching host by adding a detection function and exposing it through a new CLI command.
Sequence diagram for the new 'find-dead-zero-copy-locks' CLI command
sequenceDiagram
actor User
participant CLI
participant "remove_hosts_from_table()"
participant "find_dead_zc_locks()"
participant "zk_client"
participant "get_children()"
User->>CLI: Run 'find-dead-zero-copy-locks' command
CLI->>"remove_hosts_from_table()": Call with args (ctx, zookeeper_table_path, shard_name, fqdn)
"remove_hosts_from_table()"->>"find_dead_zc_locks()": Call with same args
"find_dead_zc_locks()"->>"zk_client": Open Zookeeper client
"find_dead_zc_locks()"->>"get_children()": Get children of zc_root_path
loop For each table
"find_dead_zc_locks()"->>"get_children()": Get children of table_path
loop For each part
"find_dead_zc_locks()"->>"get_children()": Get children of part_path
loop For each lock
"find_dead_zc_locks()"->>"get_children()": Get children of lock_path
alt If no host in fqdn
"find_dead_zc_locks()"->>CLI: Print lock_path
end
end
end
end
"find_dead_zc_locks()"-->>"zk_client": Close Zookeeper client
Class diagram for new and modified functions in Zookeeper zero-copy lock detection
classDiagram
class remove_hosts_from_table {
+remove_hosts_from_table(ctx: Context, zookeeper_table_path: str, shard_name: str, fqdn: list)
}
class find_dead_zc_locks {
+find_dead_zc_locks(ctx, zc_root_path, shard_name, fqdn)
}
remove_hosts_from_table --> find_dead_zc_locks: calls
class zk_client {
+__enter__()
+__exit__()
}
find_dead_zc_locks --> zk_client: uses
class get_children {
+get_children(zk, path)
}
find_dead_zc_locks --> get_children: uses
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Prototype detection function for dead zero copy locks |
|
ch_tools/chadmin/internal/zookeeper_clean.py |
| New CLI command to invoke dead lock detection |
|
ch_tools/chadmin/cli/zookeeper_group.py |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.