merlimat opened a new pull request, #25691:
URL: https://github.com/apache/pulsar/pull/25691
### Motivation
After #25625 (`Replication is stuck because failed to read entries`),
`PersistentReplicator.readEntriesFailed` now casts the `ctx` argument to
`InFlightTask` and calls `setEntries(Collections.emptyList())` on it.
`ReplicatorTest.testReplicatorClearBacklog` and `testReplicatorExpireMsgAsync`
were calling that method directly with a \`null\` context as a shortcut, which
now NPEs:
\`\`\`
java.lang.NullPointerException: Cannot invoke
"...InFlightTask.setEntries(java.util.List)" because "inFlightTask" is null
at
o.a.p.b.s.persistent.PersistentReplicator.readEntriesFailed(PersistentReplicator.java:518)
at
o.a.p.b.s.ReplicatorTest.testReplicatorClearBacklog(ReplicatorTest.java:666)
\`\`\`
Failing test scan:
https://scans.gradle.com/s/lg3litw5ckegw/tests/task/:pulsar-broker:test/details/org.apache.pulsar.broker.service.ReplicatorTest/testReplicatorClearBacklog/2/output
### Modifications
Pass a real `InFlightTask` instance instead of `null`. `InFlightTask` is
`protected` in `PersistentReplicator` and cannot be instantiated from the
`org.apache.pulsar.broker.service` package directly, so the construction is
routed through a new helper on `BrokerServicePersistInternalMethodInvoker` —
which is already used to expose other package-private replicator internals to
tests.
Same fix is applied to `testReplicatorExpireMsgAsync`, which uses the
identical pattern.
### Verifying this change
- `ReplicatorTest.testReplicatorClearBacklog` and
`testReplicatorExpireMsgAsync` pass locally with the change.
### Does this pull request potentially affect one of the following parts:
- [ ] Dependencies (does it add or upgrade a dependency): no
- [ ] The public API: no
- [ ] The schema: no
- [ ] The default values of configurations: no
- [ ] The threading model: no
- [ ] The binary protocol: no
- [ ] The REST endpoints: no
- [ ] The admin CLI options: no
- [ ] The metrics: no
- [ ] Anything that affects deployment: no
--
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]