dragonls opened a new pull request, #17573:
URL: https://github.com/apache/pulsar/pull/17573
Fixes #17572
### Motivation
The `lastActive` in `ManagedCursorImpl` only be updated in 3 places:
-
`org.apache.pulsar.broker.service.persistent.PersistentSubscription#addConsumer`
-
`org.apache.pulsar.broker.service.persistent.PersistentSubscription#removeConsumer`
- `org.apache.bookkeeper.mledger.impl.ManagedCursorImpl#internalResetCursor`
If there are brokers shutdown with OOM or other situation, which make the
broker not shutdown gracefully. And the new broker load the topics and then do
subscription expiry check soon before consumer reconnected, then the
subscription may be deleted unexpectedly.
Need to update `lastActive` in `ManagedCursorImpl` while consuming stably.
### Modifications
- Add `cursor.updateLastActive()` in
`org.apache.pulsar.broker.service.persistent.PersistentSubscription#acknowledgeMessage`
and
`org.apache.pulsar.broker.service.nonpersistent.NonPersistentSubscription#acknowledgeMessage`.
- Add some log about cursor last active timestamp.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- *TODO*
### Does this pull request potentially affect one of the following parts:
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc-required`
(Your PR needs to update docs and you will update later)
- [ ] `doc-not-needed`
(Please explain why)
- [ ] `doc`
(Your PR contains doc changes)
- [ ] `doc-complete`
(Docs have been already added)
--
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]