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-16208 Check that the row exists before attempting to remove a queue from TableBasedReplicationQueuesImpl
Date Tue, 12 Jul 2016 21:59:19 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 6d94925af -> f292048ff


HBASE-16208 Check that the row exists before attempting to remove a queue from TableBasedReplicationQueuesImpl

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/f292048f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f292048f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f292048f

Branch: refs/heads/master
Commit: f292048ffd91503360cb56bb9b5f60fd47e2ebe0
Parents: 6d94925
Author: Joseph Hwang <jzh@fb.com>
Authored: Mon Jul 11 10:45:53 2016 -0700
Committer: Elliott Clark <eclark@apache.org>
Committed: Tue Jul 12 14:50:07 2016 -0700

----------------------------------------------------------------------
 .../replication/TableBasedReplicationQueuesImpl.java      | 10 +++++++---
 .../hbase/replication/TestReplicationStateHBaseImpl.java  |  7 ++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/f292048f/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/TableBasedReplicationQueuesImpl.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/TableBasedReplicationQueuesImpl.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/TableBasedReplicationQueuesImpl.java
index 28fa967..3ee6fde 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/TableBasedReplicationQueuesImpl.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/replication/TableBasedReplicationQueuesImpl.java
@@ -93,11 +93,15 @@ public class TableBasedReplicationQueuesImpl extends ReplicationTableBase
 
   @Override
   public void removeQueue(String queueId) {
-
     try {
       byte[] rowKey = queueIdToRowKey(queueId);
-      Delete deleteQueue = new Delete(rowKey);
-      safeQueueUpdate(deleteQueue);
+      if (checkQueueExists(queueId)) {
+        Delete deleteQueue = new Delete(rowKey);
+        safeQueueUpdate(deleteQueue);
+      } else {
+        LOG.info("No logs were registered for queue id=" + queueId + " so no rows were removed
" +
+            "from the replication table while removing the queue");
+      }
     } catch (IOException | ReplicationException e) {
       String errMsg = "Failed removing queue queueId=" + queueId;
       abortable.abort(errMsg, e);

http://git-wip-us.apache.org/repos/asf/hbase/blob/f292048f/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateHBaseImpl.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateHBaseImpl.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateHBaseImpl.java
index ccae8a5..7ec6df8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateHBaseImpl.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateHBaseImpl.java
@@ -84,7 +84,7 @@ public class TestReplicationStateHBaseImpl {
     conf.setClass("hbase.region.replica.replication.replicationQueues.class",
       TableBasedReplicationQueuesImpl.class, ReplicationQueues.class);
     conf.setClass("hbase.region.replica.replication.replicationQueuesClient.class",
-      TableBasedReplicationQueuesClientImpl.class, ReplicationQueuesClient.class);
+        TableBasedReplicationQueuesClientImpl.class, ReplicationQueuesClient.class);
     utility.startMiniCluster();
     zkw = HBaseTestingUtility.getZooKeeperWatcher(utility);
     String replicationZNodeName = conf.get("zookeeper.znode.replication", "replication");
@@ -195,6 +195,11 @@ public class TestReplicationStateHBaseImpl {
       assertNull(rq1.getLogsInQueue("Queue1"));
       // Test that getting logs from a non-existent queue aborts
       assertEquals(6, ds1.getAbortCount());
+      // Test removing a non-existent queue does not cause an abort. This is because we can
+      // attempt to remove a queue that has no corresponding Replication Table row (if we
never
+      // registered a WAL for it)
+      rq1.removeQueue("NotHereQueue");
+      assertEquals(6, ds1.getAbortCount());
     } catch (ReplicationException e) {
       e.printStackTrace();
       fail("testAddLog received a ReplicationException");


Mime
View raw message