Skip to content
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

DBZ-5476 Fix record accumulator during statistics log entry #3772

Merged
merged 1 commit into from Aug 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -88,6 +88,9 @@ protected static enum State {
@SingleThreadAccess("polling thread")
private Instant previousOutputInstant;

@SingleThreadAccess("polling thread")
private int previousOutputBatchSize;

protected BaseSourceTask() {
// Use exponential delay to log the progress frequently at first, but the quickly tapering off to once an hour...
pollOutputDelay = ElapsedTimeStrategy.exponential(clock, INITIAL_POLL_PERIOD_IN_MILLIS, MAX_POLL_PERIOD_IN_MILLIS);
Expand Down Expand Up @@ -176,13 +179,15 @@ void logStatistics(final List<SourceRecord> records) {
if (batchSize > 0) {
SourceRecord lastRecord = records.get(batchSize - 1);
lastOffset = lastRecord.sourceOffset();
previousOutputBatchSize += batchSize;
if (pollOutputDelay.hasElapsed()) {
// We want to record the status ...
final Instant currentTime = clock.currentTime();
LOGGER.info("{} records sent during previous {}, last recorded offset: {}", batchSize,
LOGGER.info("{} records sent during previous {}, last recorded offset: {}", previousOutputBatchSize,
Strings.duration(Duration.between(previousOutputInstant, currentTime).toMillis()), lastOffset);

previousOutputInstant = currentTime;
previousOutputBatchSize = 0;
}
}
}
Expand Down