yashmayya commented on code in PR #13801:
URL: https://github.com/apache/kafka/pull/13801#discussion_r1255456909
##########
connect/runtime/src/main/java/org/apache/kafka/connect/storage/ConnectorOffsetBackingStore.java:
##########
@@ -279,8 +284,60 @@ public Future<Void> set(Map<ByteBuffer, ByteBuffer>
values, Callback<Void> callb
throw new IllegalStateException("At least one non-null offset
store must be provided");
}
+ boolean containsTombstones = values.containsValue(null);
+
+ // If there are tombstone offsets, then the failure to write to
secondary store will
+ // not be ignored. Also, for tombstone records, we first write to
secondary store and
+ // then to primary stores.
+ if (secondaryStore != null && containsTombstones) {
+ AtomicReference<Throwable> secondaryStoreTombstoneWriteError = new
AtomicReference<>();
+ FutureCallback<Void> secondaryWriteFuture = new
FutureCallback<>((secondaryWriteError, ignored) -> {
Review Comment:
Why do we need this underlying callback to handle `secondaryWriteError`?
Can't we just use a plain `FutureCallback` instantiated via the default
constructor ? The error will anyway be surfaced synchronously when we call
`get` on our `FutureCallback` (and handled in the `ExecutionException` catch
block)?
(Also mentioned in
https://github.com/apache/kafka/pull/13801#discussion_r1255451696, but that
comment was resolved and I don't seem to have permissions to un-resolve it).
##########
connect/runtime/src/main/java/org/apache/kafka/connect/storage/ConnectorOffsetBackingStore.java:
##########
@@ -279,8 +284,60 @@ public Future<Void> set(Map<ByteBuffer, ByteBuffer>
values, Callback<Void> callb
throw new IllegalStateException("At least one non-null offset
store must be provided");
}
+ boolean containsTombstones = values.containsValue(null);
+
+ // If there are tombstone offsets, then the failure to write to
secondary store will
+ // not be ignored. Also, for tombstone records, we first write to
secondary store and
+ // then to primary stores.
+ if (secondaryStore != null && containsTombstones) {
+ AtomicReference<Throwable> secondaryStoreTombstoneWriteError = new
AtomicReference<>();
+ FutureCallback<Void> secondaryWriteFuture = new
FutureCallback<>((secondaryWriteError, ignored) -> {
+ try (LoggingContext context = loggingContext()) {
+ if (secondaryWriteError != null) {
+ log.warn("Failed to write offsets with tombstone
records to secondary backing store", secondaryWriteError);
+ secondaryStoreTombstoneWriteError.compareAndSet(null,
secondaryWriteError);
+ } else {
+ log.debug("Successfully flushed
tombstone(s)-containing to secondary backing store");
Review Comment:
Same comment as https://github.com/apache/kafka/pull/13801/files#r1239708472
(also looks like that wasn't resolved either, even though the comment was
resolved).
--
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]