-
Notifications
You must be signed in to change notification settings - Fork 218
[Feature🚀] Implement GetControllerConfig Request Handler #5554
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
Conversation
|
🔊@onenewcode 🚀Thanks for your contribution🎉! 💡CodeRabbit(AI) will review your code first🔥! Note 🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥. |
WalkthroughAdded Display for StorageBackendType and a public ControllerConfig::to_properties_string() that serializes config into camelCase key=value properties. Implemented ControllerRequestProcessor::handle_get_controller_config to return the serialized properties as a RemotingCommand response. Tests added for the serialization output. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ControllerRequestProcessor as Processor
participant ControllerManager as Manager
participant RemotingCommand as Response
Client->>Processor: GetControllerConfig request
Processor->>Manager: controller_config()
Manager-->>Processor: ControllerConfig
Processor->>Processor: ControllerConfig::to_properties_string()
Processor->>Response: create_response_command()
Processor->>Response: set_body(properties bytes)
Processor-->>Client: RemotingCommand (200, body)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @rocketmq-common/src/common/controller/controller_config.rs:
- Around line 698-699: The test assertion line in controller_config.rs (the
assert! checking result.contains("raftPeers=1-127.0.0.1:9877;2-127.0.0.1:9878"))
is misformatted and fails `cargo fmt --check`; run `cargo fmt` from the
repository root to reformat the file so the assert and surrounding code conform
to rustfmt rules, then re-run `cargo fmt --check` or `cargo test` to confirm the
CI formatting error is resolved.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
rocketmq-common/src/common/controller/controller_config.rsrocketmq-controller/src/processor/controller_request_processor.rs
🧰 Additional context used
🧬 Code graph analysis (2)
rocketmq-controller/src/processor/controller_request_processor.rs (2)
rocketmq-controller/src/controller/controller_manager.rs (1)
controller_config(596-598)rocketmq-remoting/src/protocol/remoting_command.rs (1)
create_response_command(194-198)
rocketmq-common/src/common/controller/controller_config.rs (1)
rocketmq-common/src/common/namesrv/namesrv_config.rs (1)
rocketmq_home(31-33)
🪛 GitHub Actions: RocketMQ Rust CI
rocketmq-common/src/common/controller/controller_config.rs
[error] 698-699: cargo fmt --check failed. Code formatting issue detected (diff shown in log). Run 'cargo fmt' to fix formatting.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: auto-approve
🔇 Additional comments (4)
rocketmq-common/src/common/controller/controller_config.rs (3)
57-65: LGTM! Clean Display implementation.The Display trait implementation for
StorageBackendTypeprovides clear string representations that are used effectively in the properties serialization.
468-562: Well-implemented configuration serialization.The
to_properties_string()method provides a clean, comprehensive serialization of all controller configuration fields in camelCase properties format. The raft peers formatting (line 546: "id-addr") is internally consistent with the tests and provides a reasonable, parseable format.
638-700: Excellent test coverage for properties serialization.The test suite comprehensively validates the properties string generation including format validation, custom configurations, and raft peers serialization. The tests ensure each line contains exactly one '=' character and verify that custom values are correctly reflected in the output.
rocketmq-controller/src/processor/controller_request_processor.rs (1)
448-453: Perfect implementation aligned with PR objectives.The
handle_get_controller_confighandler correctly implements the requirements:
- Retrieves current controller configuration
- Serializes it to properties format using the new
to_properties_string()method- Returns a successful response with the configuration in the body
The implementation is lightweight, read-only, and can be served from any controller node without requiring consensus, exactly as specified in the PR objectives.
971d256 to
c26fa2c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5554 +/- ##
==========================================
+ Coverage 38.43% 38.56% +0.12%
==========================================
Files 815 815
Lines 110551 110724 +173
==========================================
+ Hits 42492 42696 +204
+ Misses 68059 68028 -31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
rocketmq-rust-bot
left a comment
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 - All CI checks passed ✅
mxsm
left a comment
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
Which Issue(s) This PR Fixes(Closes)
Fixes #5544
Brief Description
Implement the handle_get_controller_config method in ControllerRequestProcessor to handle queries for controller configuration. This feature allows administrators and monitoring tools to retrieve the current controller configuration settings.
How Did You Test This Change?
Add some tests
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.