HBASE-19676 CleanerChore logging improvements (BELUGA BEHR)

This commit is contained in:
tedyu 2018-01-02 06:27:41 -08:00
parent 488797f4bb
commit 69e161cf64
1 changed files with 6 additions and 6 deletions

View File

@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
public abstract class CleanerChore<T extends FileCleanerDelegate> extends ScheduledChore public abstract class CleanerChore<T extends FileCleanerDelegate> extends ScheduledChore
implements ConfigurationObserver { implements ConfigurationObserver {
private static final Logger LOG = LoggerFactory.getLogger(CleanerChore.class.getName()); private static final Logger LOG = LoggerFactory.getLogger(CleanerChore.class);
private static final int AVAIL_PROCESSORS = Runtime.getRuntime().availableProcessors(); private static final int AVAIL_PROCESSORS = Runtime.getRuntime().availableProcessors();
/** /**
@ -110,7 +110,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu
chorePoolSize = chorePoolSize == 0 ? chorePoolSize = chorePoolSize == 0 ?
calculatePoolSize(DEFAULT_CHORE_POOL_SIZE) : chorePoolSize; calculatePoolSize(DEFAULT_CHORE_POOL_SIZE) : chorePoolSize;
this.chorePool = new ForkJoinPool(chorePoolSize); this.chorePool = new ForkJoinPool(chorePoolSize);
LOG.info("Cleaner pool size is " + chorePoolSize); LOG.info("Cleaner pool size is {}", chorePoolSize);
} }
} }
@ -125,7 +125,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu
// but upmost to the number of available processors. // but upmost to the number of available processors.
int size = Math.min(Integer.valueOf(poolSize), AVAIL_PROCESSORS); int size = Math.min(Integer.valueOf(poolSize), AVAIL_PROCESSORS);
if (size == AVAIL_PROCESSORS) { if (size == AVAIL_PROCESSORS) {
LOG.warn("Use full core processors to scan dir, size={}" + size); LOG.warn("Use full core processors to scan dir, size={}", size);
} }
return size; return size;
} else if (poolSize.matches("0.[0-9]+|1.0")) { } else if (poolSize.matches("0.[0-9]+|1.0")) {
@ -157,7 +157,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu
for (String className : logCleaners) { for (String className : logCleaners) {
T logCleaner = newFileCleaner(className, conf); T logCleaner = newFileCleaner(className, conf);
if (logCleaner != null) { if (logCleaner != null) {
LOG.debug("Initialize cleaner=" + className); LOG.debug("Initialize cleaner={}", className);
this.cleanersChain.add(logCleaner); this.cleanersChain.add(logCleaner);
} }
} }
@ -216,7 +216,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu
if (runCleaner()) { if (runCleaner()) {
LOG.debug("Cleaned old files/dirs under {} successfully", oldFileDir); LOG.debug("Cleaned old files/dirs under {} successfully", oldFileDir);
} else { } else {
LOG.warn("Failed to fully clean old files/dirs under " + oldFileDir + "."); LOG.warn("Failed to fully clean old files/dirs under {}", oldFileDir);
} }
// After each clean chore, checks if receives reconfigure notification while cleaning // After each clean chore, checks if receives reconfigure notification while cleaning
if (reconfig.compareAndSet(true, false)) { if (reconfig.compareAndSet(true, false)) {
@ -268,7 +268,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu
directorySpaces.put(f, space); directorySpaces.put(f, space);
return space; return space;
} catch (IOException e) { } catch (IOException e) {
LOG.trace("Failed to get space consumed by path={}", f.getPath(), e); LOG.trace("Failed to get space consumed by path={}", f, e);
return -1; return -1;
} }
} }