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
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate final HBaseTestingUtilityprivate static final org.slf4j.Loggerorg.junit.rules.TestNameprivate static final intprivate intprivate static byte[] -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafter()voidbefore()(package private) static booleancontains(List<org.apache.hadoop.hbase.client.Result> contains, List<org.apache.hadoop.hbase.Cell> cells) Presumes sorted Cells.private booleandoesNotContain(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 voiddoNGets(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 fortableNamecontent.private voidgetMetaReplicaReadRequests(org.apache.hadoop.hbase.regionserver.Region[] metaRegions, long[] counters) private org.apache.hadoop.hbase.regionserver.RegiongetOneRegion(org.apache.hadoop.hbase.TableName tableName) private booleanisMetaRegionReplicaReplicationSource(org.apache.hadoop.hbase.regionserver.HRegionServer hrs) Returns Whether the special meta region replica peer is enabled onhrsprivate voidprimaryIncreaseReplicaIncrease(long[] before, long[] after) private voidprimaryIncreaseReplicaNoChange(long[] before, long[] after) private voidprimaryMayIncreaseReplicaNoChange(long[] before, long[] after) private voidprimaryNoChangeReplicaIncrease(long[] before, long[] after) voidvoidvoidvoidvoidTest meta region replica replication.private voidTest meta region replica replication.voidAssert that the ReplicationSource for hbase:meta gets created when hbase:meta is opened.private voidverifyDeletedReplication(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 voidverifyReplication(org.apache.hadoop.hbase.TableName tableName, int regionReplication, int startRow, int endRow, byte[] family) private voidverifyReplication(org.apache.hadoop.hbase.TableName tableName, int regionReplication, int startRow, int endRow, byte[] family, boolean present) private voidverifyReplication(org.apache.hadoop.hbase.TableName tableName, int regionReplication, List<org.apache.hadoop.hbase.client.Result> contains) Verify Replicas have results (exactly).private voidReplicas 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 fortableNamecontent.- 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 thatcellshascontainsat 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
-