hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject hbase git commit: HBASE-14840 Sink cluster reports data replication request as success though the data is not replicated(Ashish Singhi)
Date Fri, 20 Nov 2015 10:30:35 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 f56c605e7 -> 11b213101


HBASE-14840 Sink cluster reports data replication request as success
though the data is not replicated(Ashish Singhi)


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

Branch: refs/heads/branch-1
Commit: 11b213101345c9485b3abe12f3142617c90bc692
Parents: f56c605
Author: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Authored: Fri Nov 20 15:58:53 2015 +0530
Committer: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Committed: Fri Nov 20 16:00:15 2015 +0530

----------------------------------------------------------------------
 .../hbase/regionserver/RSRpcServices.java       |  6 +++--
 .../replication/TestMasterReplication.java      | 27 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/11b21310/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
index 58df66e..00d20aa 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
@@ -1734,16 +1734,18 @@ public class RSRpcServices implements HBaseRPCErrorHandler,
   public ReplicateWALEntryResponse replicateWALEntry(final RpcController controller,
       final ReplicateWALEntryRequest request) throws ServiceException {
     try {
+      checkOpen();
       if (regionServer.replicationSinkHandler != null) {
-        checkOpen();
         requestCount.increment();
         List<WALEntry> entries = request.getEntryList();
         CellScanner cellScanner = ((PayloadCarryingRpcController)controller).cellScanner();
         regionServer.getRegionServerCoprocessorHost().preReplicateLogEntries(entries, cellScanner);
         regionServer.replicationSinkHandler.replicateLogEntries(entries, cellScanner);
         regionServer.getRegionServerCoprocessorHost().postReplicateLogEntries(entries, cellScanner);
+        return ReplicateWALEntryResponse.newBuilder().build();
+      } else {
+        throw new ServiceException("Replication services are not initialized yet");
       }
-      return ReplicateWALEntryResponse.newBuilder().build();
     } catch (IOException ie) {
       throw new ServiceException(ie);
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/11b21310/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
index 8e59c2a..d63224b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java
@@ -51,6 +51,8 @@ import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
+import org.apache.hadoop.hbase.regionserver.HRegionServer;
+import org.apache.hadoop.hbase.regionserver.RSRpcServices;
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster;
@@ -60,6 +62,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import com.google.protobuf.ServiceException;
+
 @Category(LargeTests.class)
 public class TestMasterReplication {
 
@@ -246,6 +250,29 @@ public class TestMasterReplication {
     }
   }
 
+  /*
+   * Test RSRpcServices#replicateWALEntry when replication is disabled. This is to simulate
+   * HBASE-14840
+   */
+  @Test(timeout = 180000, expected = ServiceException.class)
+  public void testReplicateWALEntryWhenReplicationIsDisabled() throws Exception {
+    LOG.info("testSimplePutDelete");
+    baseConfiguration.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false);
+    Table[] htables = null;
+    try {
+      startMiniClusters(1);
+      createTableOnClusters(table);
+      htables = getHTablesOnClusters(tableName);
+
+      HRegionServer rs = utilities[0].getRSForFirstRegionInTable(tableName);
+      RSRpcServices rsrpc = new RSRpcServices(rs);
+      rsrpc.replicateWALEntry(null, null);
+    } finally {
+      close(htables);
+      shutDownMiniClusters();
+    }
+  }
+
   @After
   public void tearDown() throws IOException {
     configurations = null;


Mime
View raw message