Skip to content

Commit

Permalink
DBZ-7871 Use log level on first invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jpechane committed May 16, 2024
1 parent 178b964 commit 2dd6b46
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ public enum State {

private final List<NotificationChannel> notificationChannels;

/**
* A flag to record whether the offsets stored in the offset store are loaded for the first time.
* This is typically used to reduce logging in case a connector like PostgreSQL reads offsets
* not only on connector startup but repeatedly during execution time too.
*/
private boolean offsetLoadedInPast = false;

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 @@ -487,7 +494,13 @@ protected Offsets<P, O> getPreviousOffsets(Partition.Provider<P> provider, Offse

if (offset != null) {
found = true;
LOGGER.debug("Found previous partition offset {}: {}", partition, offset.getOffset());
if (offsetLoadedInPast) {
LOGGER.debug("Found previous partition offset {}: {}", partition, offset.getOffset());
}
else {
LOGGER.info("Found previous partition offset {}: {}", partition, offset.getOffset());
offsetLoadedInPast = true;
}
}
}

Expand Down

0 comments on commit 2dd6b46

Please sign in to comment.