Class TestMasterReplication
java.lang.Object
org.apache.hadoop.hbase.replication.TestMasterReplication
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Use a coprocessor to count puts and deletes. -
Field Summary
Modifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configuration
static final HBaseClassTestRule
private org.apache.hadoop.conf.Configuration[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final org.slf4j.Logger
private org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
private static final int
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final byte[]
private static final long
private org.apache.hadoop.hbase.client.TableDescriptor
private static final org.apache.hadoop.hbase.TableName
private HBaseTestingUtil[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
private void
private void
createTableOnClusters
(org.apache.hadoop.hbase.client.TableDescriptor table) private void
deleteAndWait
(byte[] row, org.apache.hadoop.hbase.client.Table source, org.apache.hadoop.hbase.client.Table target) private void
disablePeer
(String id, int masterClusterNumber) private void
enablePeer
(String id, int masterClusterNumber) private int
getCount
(org.apache.hadoop.hbase.client.Table t, byte[] type) private org.apache.hadoop.hbase.client.Table[]
getHTablesOnClusters
(org.apache.hadoop.hbase.TableName tableName) private void
loadAndValidateHFileReplication
(String testName, int masterNumber, int[] slaveNumbers, byte[] row, byte[] fam, org.apache.hadoop.hbase.client.Table[] tables, byte[][][] hfileRanges, int numOfRows, int[] expectedCounts, boolean toValidate) private void
putAndWait
(byte[] row, byte[] fam, org.apache.hadoop.hbase.client.Table source, org.apache.hadoop.hbase.client.Table target) private void
rollWALAndWait
(HBaseTestingUtil utility, org.apache.hadoop.hbase.TableName table, byte[] row) void
setUp()
private org.apache.hadoop.hbase.client.Table[]
setUpClusterTablesAndPeers
(int numClusters) private void
private void
startMiniClusters
(int numClusters) void
tearDown()
void
Tests that base replication peer configs are applied on peer creation and the configs are overriden if updated as part of updateReplicationPeerConfig()void
void
It tests the replication scenario involving 0 -> 1 -> 0.void
Tests the cyclic replication scenario of 0 -> 1 -> 2 -> 0 by adding and deleting rows to a table in each clusters and ensuring that the each of these clusters get the appropriate mutations.void
Tests cyclic replication scenario of 0 -> 1 -> 2 -> 1.void
It tests the replication scenario involving 0 -> 1 -> 0.void
It tests the multi slave hfile replication scenario involving 0 -> 1, 2.void
It tests the bulk loaded hfile replication scenario to only explicitly specified table column families.void
Tests the replication scenario 0 -> 0.void
private void
validateCounts
(org.apache.hadoop.hbase.client.Table[] htables, byte[] type, int[] expectedCounts) private void
wait
(byte[] row, org.apache.hadoop.hbase.client.Table target, boolean isDeleted) private void
wait
(int slaveNumber, org.apache.hadoop.hbase.client.Table target, int expectedCount)
-
Field Details
-
CLASS_RULE
-
LOG
-
baseConfiguration
-
utilities
-
configurations
-
miniZK
-
SLEEP_TIME
- See Also:
-
NB_RETRIES
- See Also:
-
tableName
-
famName
-
famName1
-
row
-
row1
-
row2
-
row3
-
row4
-
noRepfamName
-
count
-
put
-
delete
-
table
-
-
Constructor Details
-
TestMasterReplication
public TestMasterReplication()
-
-
Method Details
-
setUp
- Throws:
Exception
-
testCyclicReplication1
It tests the replication scenario involving 0 -> 1 -> 0. It does it by adding and deleting a row to a table in each cluster, checking if it's replicated. It also tests that the puts and deletes are not replicated back to the originating cluster.- Throws:
Exception
-
testLoopedReplication
Tests the replication scenario 0 -> 0. By defaultHBaseInterClusterReplicationEndpoint
, the replication peer should not be added.- Throws:
Exception
-
testHFileCyclicReplication
It tests the replication scenario involving 0 -> 1 -> 0. It does it by bulk loading a set of HFiles to a table in each cluster, checking if it's replicated.- Throws:
Exception
-
setUpClusterTablesAndPeers
private org.apache.hadoop.hbase.client.Table[] setUpClusterTablesAndPeers(int numClusters) throws Exception - Throws:
Exception
-
testCyclicReplication2
Tests the cyclic replication scenario of 0 -> 1 -> 2 -> 0 by adding and deleting rows to a table in each clusters and ensuring that the each of these clusters get the appropriate mutations. It also tests the grouping scenario where a cluster needs to replicate the edits originating from itself and also the edits that it received using replication from a different cluster. The scenario is explained in HBASE-9158- Throws:
Exception
-
testHFileMultiSlaveReplication
It tests the multi slave hfile replication scenario involving 0 -> 1, 2. It does it by bulk loading a set of HFiles to a table in master cluster, checking if it's replicated in its peers.- Throws:
Exception
-
testHFileReplicationForConfiguredTableCfs
It tests the bulk loaded hfile replication scenario to only explicitly specified table column families. It does it by bulk loading a set of HFiles belonging to both the CFs of table and set only one CF data to replicate.- Throws:
Exception
-
testCyclicReplication3
Tests cyclic replication scenario of 0 -> 1 -> 2 -> 1.- Throws:
Exception
-
testBasePeerConfigsForReplicationPeer
Tests that base replication peer configs are applied on peer creation and the configs are overriden if updated as part of updateReplicationPeerConfig()- Throws:
Exception
-
testBasePeerConfigsRemovalForReplicationPeer
- Throws:
Exception
-
testRemoveBasePeerConfigWithoutExistingConfigForReplicationPeer
- Throws:
Exception
-
tearDown
- Throws:
IOException
-
startMiniClusters
- Throws:
Exception
-
shutDownMiniClusters
- Throws:
Exception
-
createTableOnClusters
private void createTableOnClusters(org.apache.hadoop.hbase.client.TableDescriptor table) throws Exception - Throws:
Exception
-
addPeer
- Throws:
Exception
-
addPeer
private void addPeer(String id, int masterClusterNumber, int slaveClusterNumber, String tableCfs) throws Exception - Throws:
Exception
-
disablePeer
- Throws:
Exception
-
enablePeer
- Throws:
Exception
-
close
-
getHTablesOnClusters
private org.apache.hadoop.hbase.client.Table[] getHTablesOnClusters(org.apache.hadoop.hbase.TableName tableName) throws Exception - Throws:
Exception
-
validateCounts
private void validateCounts(org.apache.hadoop.hbase.client.Table[] htables, byte[] type, int[] expectedCounts) throws IOException - Throws:
IOException
-
getCount
- Throws:
IOException
-
deleteAndWait
private void deleteAndWait(byte[] row, org.apache.hadoop.hbase.client.Table source, org.apache.hadoop.hbase.client.Table target) throws Exception - Throws:
Exception
-
putAndWait
private void putAndWait(byte[] row, byte[] fam, org.apache.hadoop.hbase.client.Table source, org.apache.hadoop.hbase.client.Table target) throws Exception - Throws:
Exception
-
loadAndValidateHFileReplication
private void loadAndValidateHFileReplication(String testName, int masterNumber, int[] slaveNumbers, byte[] row, byte[] fam, org.apache.hadoop.hbase.client.Table[] tables, byte[][][] hfileRanges, int numOfRows, int[] expectedCounts, boolean toValidate) throws Exception - Throws:
Exception
-
wait
private void wait(int slaveNumber, org.apache.hadoop.hbase.client.Table target, int expectedCount) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
wait
private void wait(byte[] row, org.apache.hadoop.hbase.client.Table target, boolean isDeleted) throws Exception - Throws:
Exception
-
rollWALAndWait
private void rollWALAndWait(HBaseTestingUtil utility, org.apache.hadoop.hbase.TableName table, byte[] row) throws IOException - Throws:
IOException
-