shahrs87 commented on a change in pull request #3222:
URL: https://github.com/apache/hbase/pull/3222#discussion_r627366894



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
##########
@@ -405,4 +418,77 @@ public RecoverableZooKeeper getRecoverableZooKeeper() {
       return zk;
     }
   }
+
+  /**
+   * An {@link Abortable} implementation for tests.
+   */
+  class TestAbortable implements Abortable {
+    private volatile boolean aborted = false;
+
+    @Override
+    public void abort(String why, Throwable e) {
+      this.aborted = true;
+    }
+
+    @Override
+    public boolean isAborted() {
+      return this.aborted;
+    }
+  }
+
+  /*

Review comment:
       Fixed in latest commit.

##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
##########
@@ -405,4 +418,77 @@ public RecoverableZooKeeper getRecoverableZooKeeper() {
       return zk;
     }
   }
+
+  /**
+   * An {@link Abortable} implementation for tests.
+   */
+  class TestAbortable implements Abortable {
+    private volatile boolean aborted = false;
+
+    @Override
+    public void abort(String why, Throwable e) {
+      this.aborted = true;
+    }
+
+    @Override
+    public boolean isAborted() {
+      return this.aborted;
+    }
+  }
+
+  /*
+   Throw SessionExpiredException when zk#getData is called.
+  */
+  static class SessionExpiredZooKeeperWatcher extends ZooKeeperWatcher {
+    private RecoverableZooKeeper zk;
+
+    public SessionExpiredZooKeeperWatcher(Configuration conf, String 
identifier,
+                                          Abortable abortable) throws 
IOException {
+      super(conf, identifier, abortable);
+    }
+
+    public void init() throws Exception {
+      this.zk = spy(super.getRecoverableZooKeeper());
+      doThrow(new KeeperException.SessionExpiredException())
+        .when(zk).getData(Mockito.anyString(), Mockito.any(Watcher.class), 
Mockito.any(Stat.class));
+    }
+
+    @Override
+    public RecoverableZooKeeper getRecoverableZooKeeper() {
+      return zk;
+    }
+  }
+
+  /*
+  Tests that HMaster#abort will be called if ReplicationLogCleaner

Review comment:
       Fixed in latest commit.
   
   




-- 
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:
[email protected]


Reply via email to