Class TestMasterReplication
java.lang.Object
org.apache.hadoop.hbase.replication.TestMasterReplication
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUse a coprocessor to count puts and deletes. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configurationstatic final HBaseClassTestRuleprivate 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.Loggerprivate org.apache.hadoop.hbase.zookeeper.MiniZooKeeperClusterprivate static final intprivate 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 longprivate org.apache.hadoop.hbase.client.TableDescriptorprivate static final org.apache.hadoop.hbase.TableNameprivate HBaseTestingUtility[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate voidprivate voidcreateTableOnClusters(org.apache.hadoop.hbase.client.TableDescriptor table) private voiddeleteAndWait(byte[] row, org.apache.hadoop.hbase.client.Table source, org.apache.hadoop.hbase.client.Table target) private voiddisablePeer(String id, int masterClusterNumber) private voidenablePeer(String id, int masterClusterNumber) private intgetCount(org.apache.hadoop.hbase.client.Table t, byte[] type) private org.apache.hadoop.hbase.client.Table[]getHTablesOnClusters(org.apache.hadoop.hbase.TableName tableName) private voidloadAndValidateHFileReplication(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 voidputAndWait(byte[] row, byte[] fam, org.apache.hadoop.hbase.client.Table source, org.apache.hadoop.hbase.client.Table target) private voidrollWALAndWait(HBaseTestingUtility utility, org.apache.hadoop.hbase.TableName table, byte[] row) voidsetUp()private org.apache.hadoop.hbase.client.Table[]setUpClusterTablesAndPeers(int numClusters) private voidprivate voidstartMiniClusters(int numClusters) voidtearDown()voidTests that base replication peer configs are applied on peer creation and the configs are overriden if updated as part of updateReplicationPeerConfig()voidvoidIt tests the replication scenario involving 0 -> 1 -> 0.voidTests 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.voidTests cyclic replication scenario of 0 -> 1 -> 2 -> 1.voidIt tests the replication scenario involving 0 -> 1 -> 0.voidIt tests the multi slave hfile replication scenario involving 0 -> 1, 2.voidIt tests the bulk loaded hfile replication scenario to only explicitly specified table column families.voidTests the replication scenario 0 -> 0.voidprivate voidvalidateCounts(org.apache.hadoop.hbase.client.Table[] htables, byte[] type, int[] expectedCounts) private voidwait(byte[] row, org.apache.hadoop.hbase.client.Table target, boolean isDeleted) private voidwait(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:
IOExceptionInterruptedException
-
wait
private void wait(byte[] row, org.apache.hadoop.hbase.client.Table target, boolean isDeleted) throws Exception - Throws:
Exception
-
rollWALAndWait
private void rollWALAndWait(HBaseTestingUtility utility, org.apache.hadoop.hbase.TableName table, byte[] row) throws IOException - Throws:
IOException
-