Improve logging in CoordinatorBasedSegmentHandoffNotifier (#14640)

This commit is contained in:
aho135 2023-07-24 05:34:21 -07:00 committed by GitHub
parent 536e491d00
commit 607f511767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -26,6 +26,7 @@ import org.apache.druid.java.util.common.concurrent.Execs;
import org.apache.druid.java.util.common.logger.Logger;
import org.apache.druid.query.SegmentDescriptor;
import org.apache.druid.server.coordination.DruidServerMetadata;
import org.joda.time.Duration;
import java.util.Iterator;
import java.util.List;
@ -43,7 +44,7 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot
private final ConcurrentMap<SegmentDescriptor, Pair<Executor, Runnable>> handOffCallbacks = new ConcurrentHashMap<>();
private final CoordinatorClient coordinatorClient;
private volatile ScheduledExecutorService scheduledExecutor;
private final long pollDurationMillis;
private final Duration pollDuration;
private final String dataSource;
public CoordinatorBasedSegmentHandoffNotifier(
@ -54,7 +55,7 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot
{
this.dataSource = dataSource;
this.coordinatorClient = coordinatorClient;
this.pollDurationMillis = config.getPollDuration().getMillis();
this.pollDuration = config.getPollDuration();
}
@Override
@ -80,7 +81,7 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot
{
checkForSegmentHandoffs();
}
}, 0L, pollDurationMillis, TimeUnit.MILLISECONDS
}, 0L, pollDuration.getMillis(), TimeUnit.MILLISECONDS
);
}
@ -114,10 +115,10 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot
catch (Exception e) {
log.error(
e,
"Exception while checking handoff for dataSource[%s] Segment[%s], Will try again after [%d]secs",
"Exception while checking handoff for dataSource[%s] Segment[%s]; will try again after [%s]",
dataSource,
descriptor,
pollDurationMillis
pollDuration
);
}
}
@ -128,9 +129,9 @@ public class CoordinatorBasedSegmentHandoffNotifier implements SegmentHandoffNot
catch (Throwable t) {
log.error(
t,
"Exception while checking handoff for dataSource[%s], Will try again after [%d]secs",
"Exception while checking handoff for dataSource[%s]; will try again after [%s]",
dataSource,
pollDurationMillis
pollDuration
);
}
}