jbonofre opened a new pull request, #41504:
URL: https://github.com/apache/beam/pull/41504

   `SolaceIO` already tracks per-reader checkpoints via `ActiveReadersRegistry` 
and catches up earlier checkpoints via 
`pendingCheckpoints.headMap(checkpointId, true)` (#38603), but two remaining 
lifecycle gaps (analogous to #40605 and #41013 in `JmsIO`) remained:
   
   1. **Closing the reader immediately tore down ack resources**: 
`UnboundedSolaceReader.close()` synchronously invalidated 
`sessionServiceCache`, unregistered `readerUuid` from `ActiveReadersRegistry`, 
and shut down `ackExecutor`. Any `finalizeCheckpoint()` callback arriving after 
`reader.close()` (for instance on bundle commit after reader eviction/split) 
failed to find the reader and left messages unacknowledged.
   2. **Resuming from a checkpoint did not finalize it**: 
`UnboundedSolaceSource.createReader(options, checkpointMark)` ignored 
`checkpointMark`, so recreating a reader from a committed checkpoint in the 
same JVM without a prior finalize callback did not acknowledge those messages.
   
   ## Changes
   - Defer `sessionServiceCache.invalidate`, 
`ActiveReadersRegistry.unregister`, and `ackExecutor.shutdown()` in 
`UnboundedSolaceReader.close()` until all pending non-empty checkpoints 
finalize (or `ackDeadline` expires, closing immediately once drained).
   - Do not enqueue empty checkpoints into `pendingCheckpoints`, while still 
incrementing `checkpointId` so finalizing an empty checkpoint continues to 
acknowledge earlier pending checkpoints without blocking `close()`.
   - Call `checkpointMark.finalizeCheckpoint()` in 
`UnboundedSolaceSource.createReader()` when resuming from a non-null checkpoint.
   - Added unit test 
`SolaceIOReadTest.testRestoredCheckpointAfterCloseAndResume`.


-- 
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]

Reply via email to