Skip to content

[ISSUE #161] fix(source): keep failed-topic queues allocated and resume re-added queues from checkpoint offsets - #162

Merged
lizhimins merged 1 commit into
apache:mainfrom
lizhimins:fix/discovery-failed-topics-readd-offset
Nov 6, 2026
Merged

lizhimins merged 1 commit into
apache:mainfrom
lizhimins:fix/discovery-failed-topics-readd-offset

Conversation

@lizhimins

Copy link
Copy Markdown
Member

Fixes #161

What is the purpose of the change

Two gaps remained in periodic partition discovery after #152:

  1. Partial route-fetch failure across multiple topics still revoked the failed topic's queues. requestServiceDiscovery only skipped the round when every topic failed; on a partial failure the plain set difference against allocatedSet reported the failed topic's queues as decreased (stop-splits + full re-load-balance), and the recovery round re-initialized them. A failed fetch says nothing about the route.

  2. A revoked queue that reappeared restarted from the configured starting selector. initializeSourceSplits discarded the checkedOffsets entry on decrease, so a re-added queue (broker rolling restart, scale-down then scale-up, or the recovery phase of gap 1) was re-resolved — with earliest, replaying the whole queue from offset 0.

Brief changelog

  • The discovery callable now returns a ServiceDiscoveryResult (discovered queues + failed topics); getSourceChangeResult removes queues of failed topics from decreaseSet before acting on the change result. Increase handling is unchanged.
  • On decrease, the last checkpointed offset of a revoked queue is retained (revokedQueueOffsets, only meaningful offsets >= 0); on increase, that offset is preferred over the selector — the same rule the migration path already applies to surviving queues. The selector still applies to genuinely new queues. The retained offsets are coordinator-local (no enumerator state format change); after failover the selector applies again.

Verifying this change

  • RocketMQSourceEnumeratorDiscoveryToleranceTest: per-topic exclusion on partial failures at both the handler level (assignment untouched) and the diff level (genuine deletions on successfully fetched topics still reported), plus the existing whole-round guards.
  • New RocketMQSourceEnumeratorRevokedOffsetResumeTest: checkpoint resume on re-add, new-queue selector fallback, mixed re-added/new rounds, and the NO_STOPPING_OFFSET guard.
  • mvn clean package (JDK 17) green across all five modules; spotless:apply run on JDK 11 as in CI.

Does this pull request potentially affect one of the following parts

  • Dependencies (does it add or upgrade a dependency): no
  • The public API (i.e., is any changed class annotated with @Public(Evolving)): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery (Yarn / Mesos / Kubernetes components): no

…d resume re-added queues from checkpoint offsets

Two gaps remained in periodic partition discovery after apache#152:

1. A partial route-fetch failure across multiple topics still revoked the
   failed topic's queues: requestServiceDiscovery only skipped the round
   when every topic failed, and the plain set difference against the
   allocated set reported the failed topic's queues as decreased. The
   discovery callable now returns the failed topics together with the
   discovered queues, and the coordinator excludes their queues from the
   decrease evaluation. A failed fetch is no evidence of absence.

2. A revoked queue that reappeared restarted from the configured starting
   selector: initializeSourceSplits discarded the checkedOffsets entry on
   decrease, so the re-added queue was re-resolved (with EARLIEST, replaying
   the whole queue). The last checkpointed offset is now retained for
   revoked queues and preferred when the queue reappears, the same rule the
   migration path already applies to surviving queues. The selector still
   applies to genuinely new queues, and after coordinator failover where
   the retained offsets are lost.

RocketMQSourceEnumeratorDiscoveryToleranceTest now covers the per-topic
exclusion on partial failures at both the handler and the diff level; the
new RocketMQSourceEnumeratorRevokedOffsetResumeTest covers checkpoint
resume, new-queue selector fallback, mixed rounds, and the NO_STOPPING_OFFSET
guard.
@lizhimins
lizhimins merged commit 497fb05 into apache:main Nov 6, 2026
2 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.

remoting source: partial route-fetch failures revoke healthy queues and re-added queues restart from the configured offset

1 participant