Skip to content

Commit 602f6dd

Browse files
authored
HBASE-23687 DEBUG logging cleanup (#1040)
Signed-off-by: Jan Hentschel <janh@apache.org>
1 parent 4a35e2f commit 602f6dd

4 files changed

Lines changed: 20 additions & 13 deletions

File tree

hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/RootProcedureState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected synchronized void addRollbackStep(Procedure<TEnvironment> proc) {
148148
subprocStack = new ArrayList<>();
149149
}
150150
proc.addStackIndex(subprocStack.size());
151-
LOG.debug("Add procedure {} as the {}th rollback step", proc, subprocStack.size());
151+
LOG.trace("Add procedure {} as the {}th rollback step", proc, subprocStack.size());
152152
subprocStack.add(proc);
153153
}
154154

hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import java.util.concurrent.LinkedBlockingQueue;
2727
import java.util.concurrent.TimeUnit;
2828
import java.util.concurrent.atomic.AtomicBoolean;
29+
import java.util.stream.Collectors;
30+
2931
import org.apache.hadoop.conf.Configuration;
3032
import org.apache.hadoop.fs.FileStatus;
3133
import org.apache.hadoop.fs.FileSystem;
@@ -111,8 +113,13 @@ protected int deleteFiles(Iterable<FileStatus> filesToDelete) {
111113
results.add(new CleanerContext(file));
112114
}
113115
}
116+
if (results.isEmpty()) {
117+
return 0;
118+
}
114119

115-
LOG.debug("Old WAL files pending deletion: {}", results);
120+
LOG.debug("Old WALs for delete: {}",
121+
results.stream().map(cc -> cc.target.getPath().getName()).
122+
collect(Collectors.joining(", ")));
116123
pendingDelete.addAll(results);
117124

118125
int deletedFiles = 0;
@@ -140,7 +147,7 @@ long getCleanerThreadTimeoutMsec() {
140147
}
141148

142149
private List<Thread> createOldWalsCleaner(int size) {
143-
LOG.info("Creating {} OldWALs cleaner threads", size);
150+
LOG.info("Creating {} old WALs cleaner threads", size);
144151

145152
List<Thread> oldWALsCleaner = new ArrayList<>(size);
146153
for (int i = 0; i < size; i++) {
@@ -168,12 +175,12 @@ private void deleteFile() {
168175
Preconditions.checkNotNull(context);
169176
FileStatus oldWalFile = context.getTargetToClean();
170177
try {
171-
LOG.debug("Attempting to delete old WAL file: {}", oldWalFile);
178+
LOG.debug("Deleting {}", oldWalFile);
172179
boolean succeed = this.fs.delete(oldWalFile.getPath(), false);
173180
context.setResult(succeed);
174181
} catch (IOException e) {
175182
// fs.delete() fails.
176-
LOG.warn("Failed to clean old WAL file", e);
183+
LOG.warn("Failed to delete old WAL file", e);
177184
context.setResult(false);
178185
}
179186
} catch (InterruptedException ite) {
@@ -184,7 +191,7 @@ private void deleteFile() {
184191
Thread.currentThread().interrupt();
185192
return;
186193
}
187-
LOG.debug("Exiting");
194+
LOG.trace("Exiting");
188195
}
189196
}
190197

@@ -217,7 +224,7 @@ boolean getResult(long waitIfNotFinished) {
217224
boolean completed = this.remainingResults.await(waitIfNotFinished,
218225
TimeUnit.MILLISECONDS);
219226
if (!completed) {
220-
LOG.warn("Spend too much time [{}ms] to delete old WAL file: {}",
227+
LOG.warn("Spent too much time [{}ms] deleting old WAL file: {}",
221228
waitIfNotFinished, target);
222229
return false;
223230
}

hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,8 @@ public void completionCleanup(final Procedure proc) {
348348

349349
private static <T extends Comparable<T>> void addToRunQueue(FairQueue<T> fairq, Queue<T> queue,
350350
Supplier<String> reason) {
351-
if (LOG.isDebugEnabled()) {
352-
LOG.debug("Add {} to run queue because: {}", queue, reason.get());
351+
if (LOG.isTraceEnabled()) {
352+
LOG.trace("Add {} to run queue because: {}", queue, reason.get());
353353
}
354354
if (!AvlIterableList.isLinked(queue) && !queue.isEmpty()) {
355355
fairq.add(queue);
@@ -358,8 +358,8 @@ private static <T extends Comparable<T>> void addToRunQueue(FairQueue<T> fairq,
358358

359359
private static <T extends Comparable<T>> void removeFromRunQueue(FairQueue<T> fairq,
360360
Queue<T> queue, Supplier<String> reason) {
361-
if (LOG.isDebugEnabled()) {
362-
LOG.debug("Remove {} from run queue because: {}", queue, reason.get());
361+
if (LOG.isTraceEnabled()) {
362+
LOG.trace("Remove {} from run queue because: {}", queue, reason.get());
363363
}
364364
if (AvlIterableList.isLinked(queue)) {
365365
fairq.remove(queue);

hbase-server/src/main/java/org/apache/hadoop/hbase/procedure2/store/region/RegionProcedureStoreWALRoller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected void afterRoll(WAL wal) {
8787
Path newFile = new Path(globalWALArchiveDir,
8888
file.getName() + MasterProcedureUtil.ARCHIVED_PROC_WAL_SUFFIX);
8989
if (fs.rename(file, newFile)) {
90-
LOG.info("Successfully moved {} to {}", file, newFile);
90+
LOG.info("Moved {} to {}", file, newFile);
9191
} else {
9292
LOG.warn("Failed to move archived wal from {} to global place {}", file, newFile);
9393
}
@@ -124,4 +124,4 @@ static RegionProcedureStoreWALRoller create(Configuration conf, Abortable aborta
124124
conf.setFloat(AbstractFSWAL.WAL_ROLL_MULTIPLIER, 0.5f);
125125
return new RegionProcedureStoreWALRoller(conf, abortable, fs, walRootDir, globalWALRootDir);
126126
}
127-
}
127+
}

0 commit comments

Comments
 (0)