Skip to content

[ISSUE #11163] Fix lite topic prefix index not maintained on first message - #11164

Merged
lizhimins merged 1 commit into
apache:developfrom
f1amingo:fix/lite-prefix-index-offset
Sep 15, 2026
Merged

lizhimins merged 1 commit into
apache:developfrom
f1amingo:fix/lite-prefix-index-offset

Conversation

@f1amingo

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Brief Description

The lite topic prefix index is maintained only when the dispatcher sees offset == 0, but the message-arriving notification carries logicOffset = queueOffset + 1, so the first message of a lite topic arrives with offset == 1. The create hook thus never fires at runtime, and lite topics created after startup are missing from wildcard dispatch and parent-topic collect/count/clean until the broker restarts. This PR corrects the comparison to offset == 1 and restores the store-dependent lifecycle tests to the concrete impl test classes (file CQ and RocksDB CQ), driving the index through the real putMessage -> notify -> dispatch path so this behavior is covered.

How Did You Test This Change?

Unit tests in LiteLifecycleManagerTest (file CQ) and RocksDBLiteLifecycleManagerTest (RocksDB CQ) wire a real MessageArrivingListener + LiteEventDispatcher and assert collectByParentTopic / getLiteTopicCount / cleanByParentTopic against real putMessage. Before the fix they fail with an empty index; after the fix the lite test package passes (19 run, 0 failures). Checkstyle clean.

…rst message

- Correct the off-by-one offset check in LiteEventDispatcher.dispatch (offset == 0 -> == 1) so onLmqCreate fires on the first arriving message
- Restore store-dependent lifecycle tests to the concrete impl test classes, driven by real putMessage through the notify path
- Add MessageArrivingListener overloads to LiteTestUtil to wire the real dispatch path in tests

@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 modifies 5 files (+209/-125) in apache/rocketmq.

Observations

  • Diff size: 577 lines — moderate change, recommend careful review
  • Test coverage: ✅ Test files included

Recommendations

  • Please ensure backward compatibility if any public API is modified
  • Verify thread safety for any concurrent code paths
  • Confirm error handling is adequate for new code paths

Automated review by github-manager-bot

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.36%. Comparing base (923a80e) to head (8d30fdd).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11164      +/-   ##
=============================================
- Coverage      49.42%   49.36%   -0.07%     
+ Complexity     14246    14227      -19     
=============================================
  Files           1390     1390              
  Lines         103132   103132              
  Branches       13485    13485              
=============================================
- Hits           50969    50906      -63     
- Misses         45997    46051      +54     
- Partials        6166     6175       +9     

☔ 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.

@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.

LGTM. The changes look good.


Automated review by github-manager-bot

@lizhimins
lizhimins merged commit 80e1ae5 into apache:develop Sep 15, 2026
10 checks passed
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] Lite topics created after broker startup are not delivered to wildcard subscribers until restart

5 participants