Skip to content

[ISSUE #10876] Fix BrokerIdentityInfo.equals for partial identities - #10921

Closed
btlqql wants to merge 8 commits into
apache:developfrom
btlqql:btlqql/fix-broker-identity-equals
Closed

[ISSUE #10876] Fix BrokerIdentityInfo.equals for partial identities#10921
btlqql wants to merge 8 commits into
apache:developfrom
btlqql:btlqql/fix-broker-identity-equals

Conversation

@btlqql

@btlqql btlqql commented Aug 12, 2026

Copy link
Copy Markdown

What is the purpose of the change

Fix #10876.

BrokerIdentityInfo supports partial identities: RaftReplicasInfoManager creates instances with null clusterName and brokerId. equals() called equals directly on every field, so comparing two valid partial identities threw NullPointerException.

Brief changelog

  • BrokerIdentityInfo.equals: use Objects.equals for all three fields

How was this patch verified

  • Code review: null-safe comparison for clusterName, brokerName and brokerId
  • git diff --check clean

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

This PR fixes BrokerIdentityInfo.equals() to use Objects.equals() instead of direct .equals() calls, preventing NullPointerException when any identity field is null. This is important for partial identity comparisons where not all fields may be populated.

LGTM. Correct null-safety fix.

Note: This PR also includes changes from #10914-#10920. See the series overlap comment on those PRs.


Automated review by github-manager-bot

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review Summary

This PR fixes BrokerIdentityInfo.equals to handle partial identity comparisons correctly by using Objects.equals instead of direct .equals() calls.

Findings

  • [Critical] BrokerIdentityInfo.java — Direct .equals() calls on potentially null fields would throw NPE. Using Objects.equals safely handles null values.
  • [Info] This is important for broker identity comparison in cluster management, where some identity fields may not be set.

Overall

Good fix for NPE prevention in identity comparison logic.


Automated review by RockteMQ-AI

@RockteMQ-AI

Copy link
Copy Markdown
Contributor

⚠️ Merge conflict detected

This PR has conflicts with the base branch and cannot be merged. Please rebase or merge the base branch into your branch and resolve the conflicts:

git fetch origin
git checkout btlqql/fix-broker-identity-equals
git rebase origin/develop
# resolve conflicts, then:
git push --force-with-lease

This is a one-time reminder. Feel free to @mention me for a re-review after conflicts are resolved.


Automated notification by github-manager-bot

@btlqql

btlqql commented Aug 13, 2026

Copy link
Copy Markdown
Author

Duplicate of #10886 which already fixes BrokerIdentityInfo.equals; closing this in favor of the upstream fix.

@btlqql btlqql closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] BrokerIdentityInfo.equals throws for partial identities

3 participants