Class TestMetaRegionReplicaReplicationEndpoint
java.lang.Object
org.apache.hadoop.hbase.replication.regionserver.TestMetaRegionReplicaReplicationEndpoint
Tests RegionReplicaReplicationEndpoint class 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 HBaseTestingUtility
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 org.apache.hadoop.hbase.regionserver.Region
getOneRegion
(org.apache.hadoop.hbase.TableName tableName) private boolean
isMetaRegionReplicaReplicationSource
(org.apache.hadoop.hbase.regionserver.HRegionServer hrs) Returns Whether the special meta region replica peer is enabled onhrs
private void
primaryIncreaseReplicaIncrease
(long[] before, long[] after) private void
primaryIncreaseReplicaNoChange
(long[] before, long[] after) private void
primaryMayIncreaseReplicaNoChange
(long[] before, long[] after) private void
primaryNoChangeReplicaIncrease
(long[] before, long[] after) void
void
void
void
void
Test meta region replica replication.private void
Test meta region replica replication.void
Assert that the ReplicationSource for hbase:meta gets created when hbase:meta is opened.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).private void
Replicas come online after primary.
-
Field Details
-
CLASS_RULE
-
LOG
-
NB_SERVERS
- See Also:
-
HTU
-
numOfMetaReplica
-
VALUE
-
name
-
-
Constructor Details
-
TestMetaRegionReplicaReplicationEndpoint
-
-
Method Details
-
before
- Throws:
Exception
-
after
- Throws:
Exception
-
testHBaseMetaReplicationSourceCreatedOnOpen
Assert that the ReplicationSource for hbase:meta gets created when hbase:meta is opened.- Throws:
Exception
-
testHBaseMetaReplicatesOneRow
Test meta region replica replication. Create some tables and see if replicas pick up the additions.- Throws:
Exception
-
isMetaRegionReplicaReplicationSource
private boolean isMetaRegionReplicaReplicationSource(org.apache.hadoop.hbase.regionserver.HRegionServer hrs) Returns Whether the special meta region replica peer is enabled onhrs
-
testHBaseMetaReplicates
Test meta region replica replication. Create some tables and see if replicas pick up the additions.- Throws:
Exception
-
testCatalogReplicaReplicationWithFlushAndCompaction
- Throws:
Exception
-
testCatalogReplicaReplicationWALRolledAndDeleted
- 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
-
waitForMetaReplicasToOnline
Replicas come online after primary.- Throws:
IOException
-
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. -
getOneRegion
private org.apache.hadoop.hbase.regionserver.Region getOneRegion(org.apache.hadoop.hbase.TableName tableName) -
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
-
primaryMayIncreaseReplicaNoChange
-
primaryIncreaseReplicaIncrease
-
getMetaReplicaReadRequests
private void getMetaReplicaReadRequests(org.apache.hadoop.hbase.regionserver.Region[] metaRegions, long[] counters) -
testHBaseMetaReplicaGets
- Throws:
Exception
-