From 7a2e1fdd4ce79b43f51075890d5b18f03147dc32 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Fri, 4 Feb 2011 23:02:43 +0000 Subject: [PATCH] HBASE-3502 Remove the deletion limit in LogCleaner git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1067328 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../apache/hadoop/hbase/master/LogCleaner.java | 17 ++--------------- .../hadoop/hbase/master/TestLogsCleaner.java | 7 ------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b98884449f1..7949addd3aa 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -44,6 +44,7 @@ Release 0.91.0 - Unreleased (Ed Kohlwey via Gary Helmling) HBASE-3502 Can't open region because can't open .regioninfo because AlreadyBeingCreatedException + HBASE-3501 Remove the deletion limit in LogCleaner IMPROVEMENTS diff --git a/src/main/java/org/apache/hadoop/hbase/master/LogCleaner.java b/src/main/java/org/apache/hadoop/hbase/master/LogCleaner.java index f4252a62ab4..87e72ffc131 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/LogCleaner.java +++ b/src/main/java/org/apache/hadoop/hbase/master/LogCleaner.java @@ -37,16 +37,12 @@ import org.apache.hadoop.hbase.regionserver.wal.HLog; import static org.apache.hadoop.hbase.HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS; /** - * This Chore, everytime it runs, will clear the wal logs in the old logs folder - * that are deletable for each log cleaner in the chain, in order to limit the - * number of deletes it sends, will only delete maximum 20 in a single run. + * This Chore, everytime it runs, will clear the HLogs in the old logs folder + * that are deletable for each log cleaner in the chain. */ public class LogCleaner extends Chore { static final Log LOG = LogFactory.getLog(LogCleaner.class.getName()); - // Max number we can delete on every chore, this is to make sure we don't - // issue thousands of delete commands around the same time - private final int maxDeletedLogs; private final FileSystem fs; private final Path oldLogDir; private List logCleanersChain; @@ -64,9 +60,6 @@ public class LogCleaner extends Chore { Configuration conf, FileSystem fs, Path oldLogDir) { super("LogsCleaner", p, s); - - this.maxDeletedLogs = - conf.getInt("hbase.master.logcleaner.maxdeletedlogs", 20); this.fs = fs; this.oldLogDir = oldLogDir; this.conf = conf; @@ -127,7 +120,6 @@ public class LogCleaner extends Chore { try { FileStatus [] files = this.fs.listStatus(this.oldLogDir); if (files == null) return; - int nbDeletedLog = 0; FILE: for (FileStatus file : files) { Path filePath = file.getPath(); if (HLog.validateHLogFilename(filePath.getName())) { @@ -144,15 +136,10 @@ public class LogCleaner extends Chore { } // delete this log file if it passes all the log cleaners this.fs.delete(filePath, true); - nbDeletedLog++; } else { LOG.warn("Found a wrongly formated file: " + file.getPath().getName()); this.fs.delete(filePath, true); - nbDeletedLog++; - } - if (nbDeletedLog >= maxDeletedLogs) { - break; } } } catch (IOException e) { diff --git a/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java b/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java index 7c52b8c6e15..19220fbc0f8 100644 --- a/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java +++ b/src/test/java/org/apache/hadoop/hbase/master/TestLogsCleaner.java @@ -112,13 +112,6 @@ public class TestLogsCleaner { assertEquals(34, fs.listStatus(oldLogDir).length); - // This will take care of 20 old log files (default max we can delete) - cleaner.chore(); - - assertEquals(14, fs.listStatus(oldLogDir).length); - - // We will delete all remaining log files which are not scheduled for - // replication and those that are invalid cleaner.chore(); // We end up with the current log file, a newer one and the 3 old log