Skip to content

Conversation

BrightX
Copy link
Contributor

@BrightX BrightX commented Oct 14, 2025

Which Issue(s) This PR Fixes(Closes)

Fixes: #4176

  • 🐛 TopicConfigAndQueueMapping serde for TopicConfig and mappingDetail
  • 🐛 UpdateAndCreateTopic cannot set broker_name and attributes
  • 🐛 The connection_set of body_data is always empty, because get_connection_set() returns a cloned copy.

Brief Description

How Did You Test This Change?

Summary by CodeRabbit

  • New Features

    • Enhanced interoperability: serialized topic configuration now flattens nested topic settings and renames a mapping field to "mappingDetail".
  • Refactor

    • Broker topic registration now uses the broker's name instead of the cluster name.
    • Replaced direct manipulation of consumer connection sets with a dedicated public insertion method for improved encapsulation.

@rocketmq-rust-bot rocketmq-rust-bot self-requested a review October 14, 2025 13:39
@rocketmq-rust-bot
Copy link
Collaborator

🔊@BrightX 🚀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💥.

Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Switched topic registration to pass the broker's name, added a public insertion method for ConsumerConnection, applied serde attributes to TopicConfigAndQueueMapping fields, and a formatting-only argument adjustment in TopicConfigManager. No control-flow or error-handling behavior changes.

Changes

Cohort / File(s) Summary
Broker registration identifier
rocketmq-broker/src/broker_runtime.rs
Changed argument passed to BrokerOuterAPI::register_single_topic_all from broker_cluster_name to broker_name.
ConsumerConnection API adoption
rocketmq-broker/src/processor/admin_broker_processor/consumer_request_handler.rs, rocketmq-remoting/src/protocol/body/consumer_connection.rs
Added pub fn connection_set_insert(&mut self, Connection) to ConsumerConnection and replaced get_connection_set().insert(...) calls with connection_set_insert(...).
Serialization attribute adjustments
rocketmq-remoting/src/protocol/static_topic/topic_config_and_queue_mapping.rs
Added #[serde(flatten)] to topic_config and #[serde(rename = "mappingDetail")] to topic_queue_mapping_detail.
Formatting only
rocketmq-broker/src/topic/manager/topic_config_manager.rs
Whitespace/argument-list formatting change in AttributeUtil::alter_current_attributes call; no behavior changed.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant BrokerRuntime
    participant BrokerOuterAPI
    Note over BrokerRuntime,BrokerOuterAPI #D6EAF8: Topic registration now uses broker_name
    BrokerRuntime->>BrokerOuterAPI: register_single_topic_all(topic, broker_name, ...)
    BrokerOuterAPI-->>BrokerRuntime: registration result
Loading
sequenceDiagram
    autonumber
    participant AdminHandler
    participant ConsumerConnection
    Note over AdminHandler,ConsumerConnection #F9E79F: Insert connection via public API
    AdminHandler->>ConsumerConnection: connection_set_insert(connection)
    ConsumerConnection-->>AdminHandler: ack
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nibble keys and patch the plot,
Names aligned and connections slot.
Serde flattens, fields take flight,
Tiny hops make systems right.
Hop-hop—builds pass in morning light. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title uses an emoji and vague language (“some bugs”) and lumps multiple fixes into a single phrase without clearly summarizing the concrete modifications, which reduces clarity and readability for teammates scanning PR history. Revise the title to remove emojis and vague wording and concisely describe the key changes, for example: “Fix broker_name in topic registration, serde flatten for TopicConfigAndQueueMapping, and consumer connection insertion bug.”
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.51%. Comparing base (cf4b850) to head (c4c071f).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...-remoting/src/protocol/body/consumer_connection.rs 0.00% 3 Missing ⚠️
rocketmq-broker/src/broker_runtime.rs 0.00% 1 Missing ⚠️
...admin_broker_processor/consumer_request_handler.rs 0.00% 1 Missing ⚠️
...q-broker/src/topic/manager/topic_config_manager.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4171   +/-   ##
=======================================
  Coverage   26.51%   26.51%           
=======================================
  Files         576      576           
  Lines       81510    81510           
=======================================
  Hits        21611    21611           
  Misses      59899    59899           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rocketmq-rust-bot
Copy link
Collaborator

🔊@BrightX 🚀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💥.

@BrightX BrightX closed this Oct 15, 2025
@rocketmq-rust-bot rocketmq-rust-bot added approved PR has approved and removed ready to review waiting-review waiting review this PR labels Oct 15, 2025
@BrightX BrightX reopened this Oct 15, 2025
@rocketmq-rust-robot rocketmq-rust-robot added the bug🐛 Something isn't working label Oct 16, 2025
Copy link
Owner

@mxsm mxsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. LGTM

@mxsm mxsm merged commit 2fe74e3 into mxsm:main Oct 16, 2025
13 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI review first Ai review pr first approved PR has approved auto merge bug🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug🐛] Fixes some bugs for UpdateAndCreateTopic, GetTopicConfig and GetConsumerConnectionList

4 participants