hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject [03/50] [abbrv] hbase git commit: HBASE-14621 ReplicationLogCleaner stuck on RS crash.
Date Fri, 23 Oct 2015 22:49:23 GMT
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/6774f223
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/6774f223
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/6774f223

Branch: refs/heads/hbase-12439
Commit: 6774f223a4a1cfd3cd81a17861ac94faad3b2916
Parents: e874a31
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:02 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/6774f223/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/6774f223/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 768b015..f874523 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;
@@ -36,6 +38,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.testclassification.MasterTests;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
@@ -45,6 +49,7 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.mockito.Mockito;
 
 @Category({MasterTests.class, MediumTests.class})
 public class TestLogsCleaner {
@@ -126,6 +131,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
@@ -142,6 +148,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