bzablocki commented on code in PR #32962:
URL: https://github.com/apache/beam/pull/32962#discussion_r1848642075
##########
sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/read/UnboundedSolaceReader.java:
##########
@@ -133,14 +153,10 @@ public Instant getWatermark() {
@Override
public UnboundedSource.CheckpointMark getCheckpointMark() {
- List<BytesXMLMessage> ackQueue = new ArrayList<>();
- while (!elementsToCheckpoint.isEmpty()) {
- BytesXMLMessage msg = elementsToCheckpoint.poll();
- if (msg != null) {
- ackQueue.add(msg);
- }
- }
- return new SolaceCheckpointMark(active, ackQueue);
+ // It's possible for a checkpoint to be taken but never finalized.
+ // So we simply copy whatever safeToAckIds we currently have.
+ Map<Long, BytesXMLMessage> snapshotSafeToAckMessages =
Maps.newHashMap(safeToAckMessages);
+ return new SolaceCheckpointMark(this::markAsAcked, active,
snapshotSafeToAckMessages);
Review Comment:
Good point, but I added the try catch only around the `ackMessage` method
call. I think it could fail for other reasons, that a closed reader.
--
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]