From 602f6dd6936abbf66b824a684149066dee9f712c Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 14 Jan 2020 22:07:23 -0800 Subject: [PATCH] HBASE-23687 DEBUG logging cleanup (#1040) Signed-off-by: Jan Hentschel --- .../hbase/procedure2/RootProcedureState.java | 2 +- .../hbase/master/cleaner/LogCleaner.java | 19 +++++++++++++------ .../procedure/MasterProcedureScheduler.java | 8 ++++---- .../region/RegionProcedureStoreWALRoller.java | 4 ++-- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/RootProcedureState.java b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/RootProcedureState.java index 0dde806dfa4..440f9e7d6ec 100644 --- a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/RootProcedureState.java +++ b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/RootProcedureState.java @@ -148,7 +148,7 @@ class RootProcedureState { subprocStack = new ArrayList<>(); } proc.addStackIndex(subprocStack.size()); - LOG.debug("Add procedure {} as the {}th rollback step", proc, subprocStack.size()); + LOG.trace("Add procedure {} as the {}th rollback step", proc, subprocStack.size()); subprocStack.add(proc); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java index dcd675f73da..38e0e7ba4d4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java @@ -26,6 +26,8 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; @@ -111,8 +113,13 @@ public class LogCleaner extends CleanerChore results.add(new CleanerContext(file)); } } + if (results.isEmpty()) { + return 0; + } - LOG.debug("Old WAL files pending deletion: {}", results); + LOG.debug("Old WALs for delete: {}", + results.stream().map(cc -> cc.target.getPath().getName()). + collect(Collectors.joining(", "))); pendingDelete.addAll(results); int deletedFiles = 0; @@ -140,7 +147,7 @@ public class LogCleaner extends CleanerChore } private List createOldWalsCleaner(int size) { - LOG.info("Creating {} OldWALs cleaner threads", size); + LOG.info("Creating {} old WALs cleaner threads", size); List oldWALsCleaner = new ArrayList<>(size); for (int i = 0; i < size; i++) { @@ -168,12 +175,12 @@ public class LogCleaner extends CleanerChore Preconditions.checkNotNull(context); FileStatus oldWalFile = context.getTargetToClean(); try { - LOG.debug("Attempting to delete old WAL file: {}", oldWalFile); + LOG.debug("Deleting {}", oldWalFile); boolean succeed = this.fs.delete(oldWalFile.getPath(), false); context.setResult(succeed); } catch (IOException e) { // fs.delete() fails. - LOG.warn("Failed to clean old WAL file", e); + LOG.warn("Failed to delete old WAL file", e); context.setResult(false); } } catch (InterruptedException ite) { @@ -184,7 +191,7 @@ public class LogCleaner extends CleanerChore Thread.currentThread().interrupt(); return; } - LOG.debug("Exiting"); + LOG.trace("Exiting"); } } @@ -217,7 +224,7 @@ public class LogCleaner extends CleanerChore boolean completed = this.remainingResults.await(waitIfNotFinished, TimeUnit.MILLISECONDS); if (!completed) { - LOG.warn("Spend too much time [{}ms] to delete old WAL file: {}", + LOG.warn("Spent too much time [{}ms] deleting old WAL file: {}", waitIfNotFinished, target); return false; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java index 4e6021427f2..750da904834 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java @@ -348,8 +348,8 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler { private static > void addToRunQueue(FairQueue fairq, Queue queue, Supplier reason) { - if (LOG.isDebugEnabled()) { - LOG.debug("Add {} to run queue because: {}", queue, reason.get()); + if (LOG.isTraceEnabled()) { + LOG.trace("Add {} to run queue because: {}", queue, reason.get()); } if (!AvlIterableList.isLinked(queue) && !queue.isEmpty()) { fairq.add(queue); @@ -358,8 +358,8 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler { private static > void removeFromRunQueue(FairQueue fairq, Queue queue, Supplier reason) { - if (LOG.isDebugEnabled()) { - LOG.debug("Remove {} from run queue because: {}", queue, reason.get()); + if (LOG.isTraceEnabled()) { + LOG.trace("Remove {} from run queue because: {}", queue, reason.get()); } if (AvlIterableList.isLinked(queue)) { fairq.remove(queue); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure2/store/region/RegionProcedureStoreWALRoller.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure2/store/region/RegionProcedureStoreWALRoller.java index 7dd4d39e242..d24924f14a3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure2/store/region/RegionProcedureStoreWALRoller.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure2/store/region/RegionProcedureStoreWALRoller.java @@ -87,7 +87,7 @@ final class RegionProcedureStoreWALRoller extends AbstractWALRoller { Path newFile = new Path(globalWALArchiveDir, file.getName() + MasterProcedureUtil.ARCHIVED_PROC_WAL_SUFFIX); if (fs.rename(file, newFile)) { - LOG.info("Successfully moved {} to {}", file, newFile); + LOG.info("Moved {} to {}", file, newFile); } else { LOG.warn("Failed to move archived wal from {} to global place {}", file, newFile); } @@ -124,4 +124,4 @@ final class RegionProcedureStoreWALRoller extends AbstractWALRoller { conf.setFloat(AbstractFSWAL.WAL_ROLL_MULTIPLIER, 0.5f); return new RegionProcedureStoreWALRoller(conf, abortable, fs, walRootDir, globalWALRootDir); } -} \ No newline at end of file +}