You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/07/24 07:53:03 UTC

[GitHub] [hbase] Apache9 commented on a change in pull request #2135: HBASE-23285 LogCleaner should not delete empty oldWALs/rs directories…

Apache9 commented on a change in pull request #2135:
URL: https://github.com/apache/hbase/pull/2135#discussion_r459902424



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/TimeToLiveLogCleaner.java
##########
@@ -44,4 +60,25 @@ protected long getTtlMs(Configuration conf) {
   protected boolean valiateFilename(Path file) {
     return AbstractFSWALProvider.validateWALFilename(file.getName());
   }
+
+  @Override
+  public boolean isEmptyDirDeletable(Path dir) {
+    if (separate_oldLogDir) {
+      return isEmptyoldWALsDirDeletable(dir);
+    }
+    return true;
+  }
+
+  private boolean isEmptyoldWALsDirDeletable(Path dir) {

Review comment:
       isEmpty'O'ldWALsDirDeletable

##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/TimeToLiveLogCleaner.java
##########
@@ -34,6 +38,18 @@
 
   // default ttl = 10 minutes
   public static final long DEFAULT_TTL = 600_000L;
+  private HMaster master;
+  private boolean separate_oldLogDir = false;

Review comment:
       'separateOldLogDir'

##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestSeparateOldWALCleaner.java
##########
@@ -0,0 +1,162 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.master.cleaner;
+
+import static org.junit.Assert.assertEquals;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
+import org.apache.hadoop.hbase.StartMiniClusterOption;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.client.TableDescriptor;
+import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
+import org.apache.hadoop.hbase.regionserver.HRegion;
+import org.apache.hadoop.hbase.regionserver.HRegionServer;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.CommonFSUtils;
+import org.apache.hadoop.hbase.wal.WAL;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Test separate old wal deletion as logs are rolled.
+ */
+@Category(SmallTests.class)

Review comment:
       We have started a mini cluster in this tests so at least it should be MediumTests?  And please also set it as MasterTests?

##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/TimeToLiveLogCleaner.java
##########
@@ -44,4 +60,25 @@ protected long getTtlMs(Configuration conf) {
   protected boolean valiateFilename(Path file) {
     return AbstractFSWALProvider.validateWALFilename(file.getName());
   }
+
+  @Override
+  public boolean isEmptyDirDeletable(Path dir) {
+    if (separate_oldLogDir) {
+      return isEmptyoldWALsDirDeletable(dir);
+    }
+    return true;
+  }
+
+  private boolean isEmptyoldWALsDirDeletable(Path dir) {
+    if (master !=null && dir != null) {

Review comment:
       master and dir could be null?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org