Skip to content

[ISSUE #11037] Encode delay message propertiesString after clearing internal properties - #11505

Open
lihanyu1715446406-afk wants to merge 1 commit into
apache:developfrom
lihanyu1715446406-afk:fix/delay-properties-string-after-clear
Open

lihanyu1715446406-afk wants to merge 1 commit into
apache:developfrom
lihanyu1715446406-afk:fix/delay-properties-string-after-clear

Conversation

@lihanyu1715446406-afk

Copy link
Copy Markdown

What is the purpose of the change

ScheduleMessageService#messageTimeUp encodes propertiesString from msgExt.getProperties() before removing the internal scheduling properties. MessageAccessor.clearProperty only removes entries from the in-memory property map, so the encoded wire data — which is what gets persisted and decoded by consumers — still carries DELAY_TIME_LEVEL, TIMER_DELIVER_MS and TIMER_DELAY_SEC.

Move the encoding after the clearProperty calls and encode msgInner.getProperties(), matching the ordering already used by TimerMessageStore#convertMessage (the timer-wheel path fixed in #10972).

Brief changelog

  • Encode propertiesString after the internal properties are cleared.
  • Add ScheduleMessageServiceTest#testMessageTimeUpPropertiesStringMatchesProperties, which asserts that the delivered message's propertiesString contains none of the internal properties and equals a re-encoding of the final property map.

Verifications

  • Without the production change, the new test fails with AssertionError on assertFalse(delivered.getPropertiesString().contains(PROPERTY_DELAY_TIME_LEVEL)).
  • With the change: Tests run: 5, Failures: 0, Errors: 0, Skipped: 0.

Fixes #11037.

Note: an earlier attempt, #11038, was closed unmerged. This PR is an independent implementation of the fix with a regression test, as the issue is still open.

…ring internal properties

ScheduleMessageService#messageTimeUp encoded msgInner.propertiesString from
msgExt.getProperties() before PROPERTY_DELAY_TIME_LEVEL,
PROPERTY_TIMER_DELIVER_MS and PROPERTY_TIMER_DELAY_SEC were cleared.
MessageAccessor.clearProperty only removes entries from the property map,
so the persisted wire data kept the internal properties while the in-memory
map did not.

Encode after the properties are finalized, matching the ordering already
used by TimerMessageStore#convertMessage. Add a regression test that
asserts the delivered propertiesString contains none of the internal
properties and equals a re-encoding of the final property map.
@lihanyu1715446406-afk

Copy link
Copy Markdown
Author

Friendly ping — could a committer approve the CI run for this PR? The regression test fails without the production change and passes with it. Happy to adjust anything if needed.

@lihanyu1715446406-afk

Copy link
Copy Markdown
Author

Local verification on this branch (JDK 17):

  • mvn -pl broker -am test -Dtest=ScheduleMessageServiceTest — 5/5 pass, including the new testMessageTimeUpPropertiesStringMatchesProperties.
  • Restoring the original ordering (setPropertiesString from msgExt.getProperties() before the clearProperty calls) makes the new test fail with java.lang.AssertionError, so it pins the regression.
  • mvn -pl broker -am validate — 0 Checkstyle violations.

One process item is still blocking the PR: every pull-request workflow run (Build and Run Tests by Maven, Run Integration Tests, CodeQL, ...) is in action_required state waiting for approval, since this is my first contribution to Apache RocketMQ. Could a committer approve the workflow runs so the checks can report? Happy to adjust anything if the CI surfaces an issue.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.80%. Comparing base (0e839a9) to head (c43b2c0).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11505      +/-   ##
=============================================
- Coverage      49.87%   49.80%   -0.08%     
+ Complexity     14420    14405      -15     
=============================================
  Files           1391     1391              
  Lines         103361   103361              
  Branches       13519    13519              
=============================================
- Hits           51554    51478      -76     
- Misses         45601    45665      +64     
- Partials        6206     6218      +12     

☔ View full report in Codecov by Harness.
📢 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.

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] Delay messages are delivered with internal properties leaked into propertiesString (ScheduleMessageService#messageTimeUp)

2 participants