Skip to content

[ISSUE #10955] Preserve the initial offset for the first orderly pull - #11643

Open
BILLYisavailable wants to merge 2 commits into
apache:developfrom
BILLYisavailable:codex/fix-10955-ordered-start-offset
Open

BILLYisavailable wants to merge 2 commits into
apache:developfrom
BILLYisavailable:codex/fix-10955-ordered-start-offset

Conversation

@BILLYisavailable

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Brief Description

Issue #10955 has remained open since 2026-08-18, with no linked implementation PR at the time of this submission. It concerns silent omission of newly produced messages during orderly-consumer startup, affecting the core delivery path.

When no committed offset exists, rebalance resolves CONSUME_FROM_LAST_OFFSET to the queue's current end. The first orderly pull resolves the policy again: if the queue has grown from 9 to 10, it starts at 10 and skips the message at offset 9. The added regression reproduces this on develop at 19352a246, with the process queue already locked.

Re-read the committed offset before the first pull, retaining the initial pull offset only when the offset store reports no committed offset. Both newer and smaller committed offsets still take precedence; lookup errors still defer the pull. This differs from #5466, which sets the process queue's locked flag but leaves this second policy evaluation in place.

How Did You Test This Change?

  • The first-pull and lookup-retry regressions fail before the fix: the pull request uses offset 10 instead of 9.
  • All 5 new tests pass: missing offset, newer/smaller committed offsets, lookup failure, and retry after lookup failure.
  • Related client tests: 65 tests, 0 failures, 0 errors, 1 existing skipped test. Checkstyle and SpotBugs pass.
mvn -pl client -am \
  -Dtest=OrderedConsumerOffsetTest,DefaultMQPushConsumerImplTest,RebalancePushImplTest,RemoteBrokerOffsetStoreTest \
  -Dsurefire.failIfNoSpecifiedTests=false \
  -Djacoco-maven-plugin.version=0.8.12 test

Tested with JDK 17 and Maven 3.9.11. The command-line JaCoCo override supports JDK 17; the project POM is unchanged.

Replace verifyZeroInteractions with verifyNoInteractions so OrderedConsumerOffsetTest compiles with the Mockito version resolved by Bazel. The offset lookup failure test continues to assert that no pull API calls occur.

Validation: Maven client regression suite passes (65 tests, 0 failures, 0 errors, 1 existing skip), including all 5 ordered offset tests; Checkstyle and SpotBugs pass. Tested with JDK 17, Maven 3.9.11, and the command-line JaCoCo 0.8.12 override.
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] 顺序消费丢失消息一条(生产环境)

1 participant