merlimat opened a new pull request, #25623:
URL: https://github.com/apache/pulsar/pull/25623
## Summary
The V5 scalable consumer keeps a long-lived subscription against the topic
controller — that's the channel the broker uses to push assignment updates
(split / merge / peer join / peer leave). Until now `connectionClosed()` just
dropped the cnx and left a TODO; once the channel went down the session was
stranded, so a transient network blip silently turned the StreamConsumer into
a stale subscriber.
This PR implements the reconnect path:
- Factor the lookup → connect → register → subscribe flow out of `start()`
into `connectAndSubscribe()`, returning the assignment future.
- On `connectionClosed()` after the initial assignment has arrived, schedule
a reconnect via the v4 client's `HashedWheelTimer` with a `Backoff` (100 ms
initial, 30 s cap). If the initial subscribe never completed we still fail
the caller — only steady-state drops retry.
- `reconnect()` re-runs `connectAndSubscribe()` and feeds the response
through
`onAssignmentUpdate`, so within the broker grace window it's a no-op for
the
listener and past-grace the standard diff path applies the rebalance.
Adds a package-private `forceCloseConnectionForTesting()` hook so
cross-module
tests can sever the channel via reflection.
## Tests
- `testStreamConsumerSurvivesConnectionDrop` — sole consumer, force-close
controller channel, verify a second batch produced after the drop is fully
delivered.
- `testReconnectWithinGracePreservesAssignment` — alice + bob on a 4-segment
topic; force-close alice's channel; assert each consumer's per-key share is
identical across batches (proves the reconnect re-attached without
rebalancing).
### Matching PR(s) in forked repositories
- area/client
- area/test
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]