hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecl...@apache.org
Subject hbase git commit: HBASE-14621 ReplicationLogCleaner stuck on RS crash.
Date Fri, 16 Oct 2015 22:28:42 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 cf23ae750 -> a68d50db0


HBASE-14621 ReplicationLogCleaner stuck on RS crash.

Signed-off-by: Elliott Clark <eclark@apache.org>


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

Branch: refs/heads/branch-1.1
Commit: a68d50db061b69058c1f94fced8b2ab872b00f90
Parents: cf23ae7
Author: Ashu Pachauri <ashu210890@gmail.com>
Authored: Thu Oct 15 11:58:33 2015 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Fri Oct 16 15:26:38 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/a68d50db/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 474f497..a6b6dd8 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/a68d50db/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 eea520c..0ff71af 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;
@@ -37,6 +39,8 @@ import org.apache.hadoop.hbase.Waiter;
 import org.apache.hadoop.hbase.client.ClusterConnection;
 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.zookeeper.MetaTableLocator;
 import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
@@ -44,6 +48,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 {
@@ -125,6 +130,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
@@ -141,6 +147,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