Class TestMetaRegionReplicaReplication
java.lang.Object
org.apache.hadoop.hbase.replication.regionserver.TestMetaRegionReplicaReplication
Tests region replication for hbase:meta by setting up region replicas and verifying async wal
replication replays the edits to the secondary region in various scenarios.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private final HBaseTestingUtil
private static final org.slf4j.Logger
org.junit.rules.TestName
private static final int
private int
private static byte[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
after()
void
before()
(package private) static boolean
contains
(List<org.apache.hadoop.hbase.client.Result> contains, List<org.apache.hadoop.hbase.Cell> cells) Presumes sorted Cells.private boolean
doesNotContain
(List<org.apache.hadoop.hbase.Cell> cells, org.apache.hadoop.hbase.TableName tableName) Cells are from hbase:meta replica so will start w/ 'tableName,'; i.e.private void
doNGets
(org.apache.hadoop.hbase.client.Table table, byte[][] keys) private org.apache.hadoop.hbase.regionserver.Region[]
getAllRegions
(org.apache.hadoop.hbase.TableName tableName, int replication) Returns All Regions for tableName including Replicas.private List<org.apache.hadoop.hbase.client.Result>
getMetaCells
(org.apache.hadoop.hbase.TableName tableName) Scan hbase:meta fortableName
content.private void
getMetaReplicaReadRequests
(org.apache.hadoop.hbase.regionserver.Region[] metaRegions, long[] counters) private void
primaryIncreaseReplicaIncrease
(long[] before, long[] after) private void
primaryIncreaseReplicaNoChange
(long[] before, long[] after) private void
primaryNoChangeReplicaIncrease
(long[] before, long[] after) void
void
void
void
Test meta region replica replication.private void
verifyDeletedReplication
(org.apache.hadoop.hbase.TableName tableName, int regionReplication, org.apache.hadoop.hbase.TableName deletedTableName) Verify when a Table is deleted from primary, then there are no references in replicas (because they get the delete of the table rows too).protected void
verifyReplication
(org.apache.hadoop.hbase.TableName tableName, int regionReplication, int startRow, int endRow, byte[] family) private void
verifyReplication
(org.apache.hadoop.hbase.TableName tableName, int regionReplication, int startRow, int endRow, byte[] family, boolean present) private void
verifyReplication
(org.apache.hadoop.hbase.TableName tableName, int regionReplication, List<org.apache.hadoop.hbase.client.Result> contains) Verify Replicas have results (exactly).
-
Field Details
-
CLASS_RULE
-
LOG
-
NB_SERVERS
- See Also:
-
HTU
-
numOfMetaReplica
-
VALUE
-
name
-
-
Constructor Details
-
TestMetaRegionReplicaReplication
public TestMetaRegionReplicaReplication()
-
-
Method Details
-
before
- Throws:
Exception
-
after
- Throws:
Exception
-
testHBaseMetaReplicates
Test meta region replica replication. Create some tables and see if replicas pick up the additions.- Throws:
Exception
-
testCatalogReplicaReplicationWithFlushAndCompaction
- Throws:
Exception
-
testCatalogReplicaReplicationWithReplicaMoved
- Throws:
Exception
-
verifyReplication
protected void verifyReplication(org.apache.hadoop.hbase.TableName tableName, int regionReplication, int startRow, int endRow, byte[] family) throws Exception - Throws:
Exception
-
verifyReplication
private void verifyReplication(org.apache.hadoop.hbase.TableName tableName, int regionReplication, int startRow, int endRow, byte[] family, boolean present) throws Exception - Throws:
Exception
-
getMetaCells
private List<org.apache.hadoop.hbase.client.Result> getMetaCells(org.apache.hadoop.hbase.TableName tableName) throws IOException Scan hbase:meta fortableName
content.- Throws:
IOException
-
getAllRegions
private org.apache.hadoop.hbase.regionserver.Region[] getAllRegions(org.apache.hadoop.hbase.TableName tableName, int replication) Returns All Regions for tableName including Replicas. -
verifyDeletedReplication
private void verifyDeletedReplication(org.apache.hadoop.hbase.TableName tableName, int regionReplication, org.apache.hadoop.hbase.TableName deletedTableName) Verify when a Table is deleted from primary, then there are no references in replicas (because they get the delete of the table rows too). -
doesNotContain
private boolean doesNotContain(List<org.apache.hadoop.hbase.Cell> cells, org.apache.hadoop.hbase.TableName tableName) Cells are from hbase:meta replica so will start w/ 'tableName,'; i.e. the tablename followed by HConstants.DELIMITER. Make sure the deleted table is no longer present in passedcells
. -
verifyReplication
private void verifyReplication(org.apache.hadoop.hbase.TableName tableName, int regionReplication, List<org.apache.hadoop.hbase.client.Result> contains) Verify Replicas have results (exactly). -
contains
static boolean contains(List<org.apache.hadoop.hbase.client.Result> contains, List<org.apache.hadoop.hbase.Cell> cells) throws IOException Presumes sorted Cells. Verify thatcells
hascontains
at least.- Throws:
IOException
-
doNGets
- Throws:
Exception
-
-
primaryIncreaseReplicaNoChange
-
primaryIncreaseReplicaIncrease
-
getMetaReplicaReadRequests
private void getMetaReplicaReadRequests(org.apache.hadoop.hbase.regionserver.Region[] metaRegions, long[] counters) -
testHBaseMetaReplicaGets
- Throws:
Exception
-