Skip to content

[ISSUE #11468] fix(proxy): keep every system property key on admin-sent messages - #11469

Open
Felix-Gong wants to merge 1 commit into
apache:developfrom
Felix-Gong:fix/admin-send-message-keeps-all-system-keys
Open

Felix-Gong wants to merge 1 commit into
apache:developfrom
Felix-Gong:fix/admin-send-message-keeps-all-system-keys

Conversation

@Felix-Gong

Copy link
Copy Markdown

Fixes #11468

buildAdminMessage kept only the first non-empty entry of the repeated system_properties.keys field (setKeys + break), so an AdminSendMessage carrying several index keys stored just one of them and still answered OK. The data plane keeps the whole list — SendMessageActivity hands system_properties.keys to Message.setKeys(Collection), which joins it.

The change collects every non-empty key and passes the list to setKeys, matching the data plane. Precedence with the singular key field is untouched: a non-empty system_properties.keys still overrides it, and an all-empty list leaves the singular key in place.

Test: adminSendMessageKeepsAllSystemPropertyKeysTest sends ["key1", "", "key2", "key3"] and asserts the stored message carries key1 key2 key3. It fails with key1 vs key1 key2 key3 on the unpatched service (checked both ways). Full proxy module: 454 tests green on JDK 11.

Coordination: PR #11357 touches selectQueue in the same class for #11356; this change is confined to buildAdminMessage and its key handling, so the two do not overlap.

…min-sent messages

buildAdminMessage read request.system_properties.keys but kept only the
first non-empty entry (setKeys + break). The data plane preserves the
whole repeated field (SendMessageActivity joins the list via
Message.setKeys(Collection)), so an AdminSendMessage carrying several
index keys silently lost all but the first while still answering OK.

Collect every non-empty key and hand the full list to setKeys, matching
the data plane. Precedence with the singular key field is unchanged: a
non-empty system_properties.keys still overrides it, and an all-empty
list leaves the singular key in place.

The new adminSendMessageKeepsAllSystemPropertyKeysTest fails with
key1 vs 'key1 key2 key3' on the unpatched service (verified red/green).
Full proxy module: 454 tests green on JDK 11.

@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 by github-manager-bot

Summary

Fixes buildAdminMessage in ProxyAdminGrpcService to retain all non-empty keys from system_properties.keys instead of only the first one, aligning the admin path with the data plane behavior.

Findings

  • [Info] ProxyAdminGrpcService.java:1413-1421 — Clean fix. The original break after the first non-empty key was clearly a bug; collecting into a List<String> and passing to setKeys(List) correctly mirrors SendMessageActivity / Message.setKeys(Collection).
  • [Info] ProxyAdminGrpcService.java:1416 — The if (!keys.isEmpty()) guard correctly preserves the precedence contract: when all entries in system_properties.keys are empty, the singular key field remains untouched. Good defensive coding.
  • [Info] ProxyAdminGrpcServiceTest.java:1281-1311 — Test adminSendMessageKeepsAllSystemPropertyKeysTest is well-structured: it sends ["key1", "", "key2", "key3"] and asserts the stored message carries key1 key2 key3. The empty-string filtering is covered. The bidirectional verification (fails on unpatched code, passes on patched) adds confidence.

Suggestions

  • Minor: consider adding a test case where all entries in system_properties.keys are empty strings, to verify the singular key fallback is preserved. This would lock in the precedence contract explicitly.

Overall this is a clean, minimal, well-tested bug fix. LGTM. 👍


Automated review by github-manager-bot

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] AdminSendMessage keeps only the first system property key, dropping the rest

2 participants