AsyncIndexUpdate: improve logging when checkpoint cleanup gets skipped
@@ -636,12 +636,18 @@ public class AsyncIndexUpdate implements Runnable, Closeable {
}
private void maybeCleanUpCheckpoints() {
- // clean up every five minutes
- long currentMinutes = TimeUnit.MILLISECONDS.toMinutes(
- System.currentTimeMillis());
- if (!indexStats.isFailing()
- && cleanupIntervalMinutes > -1
- && lastCheckpointCleanUpTime + cleanupIntervalMinutes < currentMinutes) {
+ if (cleanupIntervalMinutes < 0) {
+ log.debug("checkpoint cleanup skipped because cleanupIntervalMinutes set to: " + cleanupIntervalMinutes);
+ } else if (indexStats.isFailing()) {
+ log.debug("checkpoint cleanup skipped because index stats are failing: " + indexStats);
+ } else {
+ // clean up every five minutes by default
+ long currentMinutes = TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis());
+ long scheduledInMinutes = (lastCheckpointCleanUpTime + cleanupIntervalMinutes) - currentMinutes;
+
+ if (scheduledInMinutes > 0) {
+ log.debug("checkpoint cleanup scheduled in " + scheduledInMinutes + " minutes");
+ } else {
try {
cleanUpCheckpoints();
} catch (Throwable e) {
@@ -650,6 +656,7 @@ public class AsyncIndexUpdate implements Runnable, Closeable {
lastCheckpointCleanUpTime = currentMinutes;
}
}
+ }
void cleanUpCheckpoints() {
log.debug("[{}] Cleaning up orphaned checkpoints", name);
