hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-14621 ReplicationLogCleaner gets stuck when a regionserver crashes (Ashu Pachauri)
Date Fri, 16 Oct 2015 22:47:55 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 7aa5a8977 -> 50968d70a


HBASE-14621 ReplicationLogCleaner gets stuck when a regionserver crashes (Ashu Pachauri)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/50968d70
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/50968d70
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/50968d70

Branch: refs/heads/0.98
Commit: 50968d70af5c427a61facd4da9744f565d2b56cd
Parents: 7aa5a89
Author: tedyu <yuzhihong@gmail.com>
Authored: Fri Oct 16 15:47:50 2015 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Fri Oct 16 15:47:50 2015 -0700

----------------------------------------------------------------------
 .../master/ReplicationLogCleaner.java           |  2 +-
 .../hbase/master/cleaner/TestLogsCleaner.java   | 24 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/50968d70/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
index 32b5536..d5ddfde 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java
@@ -95,8 +95,8 @@ public class ReplicationLogCleaner extends BaseLogCleanerDelegate implements
Abo
    * not be included.
    */
   private Set<String> loadWALsFromQueues() throws KeeperException {
-    int v0 = replicationQueues.getQueuesZNodeCversion();
     for (int retry = 0; ; retry++) {
+      int v0 = replicationQueues.getQueuesZNodeCversion();
       List<String> rss = replicationQueues.getListOfReplicators();
       if (rss == null) {
         LOG.debug("Didn't find any region server that replicates, won't prevent any deletions.");

http://git-wip-us.apache.org/repos/asf/hbase/blob/50968d70/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
index 0e9b308..cdf143e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
@@ -20,7 +20,9 @@ package org.apache.hadoop.hbase.master.cleaner;
 import static org.junit.Assert.assertEquals;
 
 import java.io.IOException;
+import java.lang.reflect.Field;
 import java.net.URLEncoder;
+import java.util.LinkedList;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
@@ -30,6 +32,8 @@ import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.catalog.CatalogTracker;
 import org.apache.hadoop.hbase.replication.ReplicationFactory;
 import org.apache.hadoop.hbase.replication.ReplicationQueues;
+import org.apache.hadoop.hbase.replication.ReplicationQueuesClient;
+import org.apache.hadoop.hbase.replication.master.ReplicationLogCleaner;
 import org.apache.hadoop.hbase.replication.regionserver.Replication;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
@@ -37,6 +41,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.mockito.Mockito;
 
 @Category(MediumTests.class)
 public class TestLogsCleaner {
@@ -118,6 +123,7 @@ public class TestLogsCleaner {
     assertEquals(34, fs.listStatus(oldLogDir).length);
 
     LogCleaner cleaner  = new LogCleaner(1000, server, conf, fs, oldLogDir);
+
     cleaner.chore();
 
     // We end up with the current log file, a newer one and the 3 old log
@@ -134,6 +140,24 @@ public class TestLogsCleaner {
     }
   }
 
+  @Test(timeout=5000)
+  public void testZnodeCversionChange() throws Exception {
+    Configuration conf = TEST_UTIL.getConfiguration();
+    ReplicationLogCleaner cleaner = new ReplicationLogCleaner();
+    cleaner.setConf(conf);
+
+    ReplicationQueuesClient rqcMock = Mockito.mock(ReplicationQueuesClient.class);
+    Mockito.when(rqcMock.getQueuesZNodeCversion()).thenReturn(1, 2, 3, 4);
+
+    Field rqc = ReplicationLogCleaner.class.getDeclaredField("replicationQueues");
+    rqc.setAccessible(true);
+
+    rqc.set(cleaner, rqcMock);
+
+    // This should return eventually when cversion stabilizes
+    cleaner.getDeletableFiles(new LinkedList<FileStatus>());
+  }
+
   static class DummyServer implements Server {
 
     @Override


Mime
View raw message