Skip to content

[ISSUE 365] fix queryMessagesByTopic#364

Open
1782935682 wants to merge 1 commit into
apache:masterfrom
1782935682:feat/fix_queryMsgsByTopic
Open

[ISSUE 365] fix queryMessagesByTopic#364
1782935682 wants to merge 1 commit into
apache:masterfrom
1782935682:feat/fix_queryMsgsByTopic

Conversation

@1782935682

@1782935682 1782935682 commented Aug 29, 2025

Copy link
Copy Markdown

What is the purpose of the change

根据topic查询消息重复

fix #365

Brief changelog

XX

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

@1782935682 1782935682 changed the title fix queryMessagesByTopic [ISSUE 365] fix queryMessagesByTopic Aug 29, 2025

@oss-sentinel-ai oss-sentinel-ai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review: Approved ✅

PR: #364 — [ISSUE 365] fix queryMessagesByTopic
Type: Bug fix (1 file, +2)

Assessment

Fixes message query by topic functionality in MessageServiceImpl. Adds missing logic for topic-based message queries.

Verdict

✅ Clean, targeted fix.


🤖 Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

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 duplicate message results when querying by topic. The root cause was that start offset was not being updated after each pull() call, causing the same messages to be fetched repeatedly.

Findings

  • [Info] MessageServiceImpl.java:373 — Adding start = pullResult.getNextBeginOffset() after the pull() call is the correct fix. Without this, the start variable remained at its initial value, causing the while loop to re-pull from the same offset on each iteration.

  • [Warning] The fix is minimal (2 lines added) but the PR description could be more detailed. The issue (#365) title mentions 'queryMessagesByTopic 重复' but the body doesn't explain the root cause or reproduction steps. Consider updating the PR description for future maintainability.

  • [Info] No test was added for this fix. Consider adding a unit test that verifies queryMessagesByTopic returns distinct results when multiple pages are pulled.

Suggestions

  • Add a brief explanation in the PR body or a code comment about why the offset update was missing.
  • Consider adding a regression test to prevent this from recurring.

Verdict

Correct bug fix. The missing offset update was clearly a logic error. Low risk.


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] 根据topic查询消息重复

3 participants