-
Notifications
You must be signed in to change notification settings - Fork 4
some logging and assertions we added for antithesis tests #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,10 @@ public void removeProcessor(final String processorName, final int partition) { | |
| if (inFlightForTask != null) { | ||
| log.info("Cancelling {} pending records for {}[{}]", | ||
| inFlightForTask.size(), processorName, partition); | ||
| if (!inFlightForTask.isEmpty()) { | ||
| log.info("ANTITHESIS SOMETIMES: cancelling {} pending records for {}[{}]", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is |
||
| inFlightForTask.size(), processorName, partition); | ||
| } | ||
| inFlightForTask.values().forEach(f -> f.future().cancel(true)); | ||
| } | ||
| } | ||
|
|
@@ -253,6 +257,10 @@ public void shutdown() { | |
| executor.shutdownNow(); | ||
| } | ||
|
|
||
| public boolean isShutdown() { | ||
| return executor.isShutdown(); | ||
| } | ||
|
|
||
| static class InFlightEvent { | ||
| private final CompletableFuture<StreamsException> future; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,4 +18,8 @@ public interface SchedulingQueue<KIn> { | |
| void offer(AsyncEvent event); | ||
|
|
||
| boolean keyQueueIsFull(KIn key); | ||
|
|
||
| int size(); | ||
|
|
||
| int blockedEntries(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,7 @@ public class CommitBuffer<K extends Comparable<K>, P> | |
| private KafkaFuture<DeletedRecords> deleteRecordsFuture = KafkaFuture.completedFuture(null); | ||
|
|
||
| private Instant lastFlush; | ||
| private long lastFlushedOffset = -1; | ||
|
|
||
| static <K extends Comparable<K>, P> CommitBuffer<K, P> from( | ||
| final BatchFlusher<K, P> batchFlusher, | ||
|
|
@@ -409,6 +410,18 @@ private boolean triggerFlush() { | |
| } | ||
|
|
||
| public void flush(final long consumedOffset) { | ||
| if (consumedOffset < lastFlushedOffset) { | ||
| log.error("trying to commit an offset {} older than last flushed {}", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when can this happen? Can we make this error message more actionable (or is it safe to ignore/just got fenced?) |
||
| consumedOffset, | ||
| lastFlushedOffset | ||
| ); | ||
| throw new IllegalStateException(String.format( | ||
| "trying to commit an offset(%d) older than last flushed(%d)", | ||
| consumedOffset, | ||
| lastFlushedOffset | ||
| )); | ||
| } | ||
|
|
||
| if (!triggerFlush()) { | ||
| return; | ||
| } | ||
|
|
@@ -417,6 +430,7 @@ public void flush(final long consumedOffset) { | |
|
|
||
| doFlush(consumedOffset, maxBatchSize); | ||
|
|
||
| lastFlushedOffset = consumedOffset; | ||
| lastFlush = clock.get(); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,12 @@ public synchronized List<ResponsiveStoreRegistration> getRegisteredStoresForChan | |
| "there should always be a store for the thread (%s) if there are stores registered " | ||
| + "for this topic partition (%s)", threadId, topicPartition)); | ||
| } | ||
| if (storesForThread.size() > 1) { | ||
| LOGGER.warn("found more than 1 registration: {}", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably already in each registration but let's just add |
||
| storesForThread.stream().map(ResponsiveStoreRegistration::toString) | ||
| .collect(Collectors.joining(",")) | ||
| ); | ||
| } | ||
| return storesForThread; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's log which key is backing off, size of queue and back off time (if that's easily accessible)