Search in sources :

Example 1 with Locator

use of org.apache.hadoop.hbase.client.RegionReplicaTestHelper.Locator in project hbase by apache.

the class TestAsyncNonMetaRegionLocator method testRegionReplicas.

@Test
public void testRegionReplicas() throws Exception {
    TEST_UTIL.getAdmin().createTable(TableDescriptorBuilder.newBuilder(TABLE_NAME).setColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY)).setRegionReplication(3).build());
    TEST_UTIL.waitUntilAllRegionsAssigned(TABLE_NAME);
    testLocator(TEST_UTIL, TABLE_NAME, new Locator() {

        @Override
        public void updateCachedLocationOnError(HRegionLocation loc, Throwable error) throws Exception {
            locator.updateCachedLocationOnError(loc, error);
        }

        @Override
        public RegionLocations getRegionLocations(TableName tableName, int replicaId, boolean reload) throws Exception {
            return locator.getRegionLocations(tableName, EMPTY_START_ROW, replicaId, RegionLocateType.CURRENT, reload).get();
        }
    });
}
Also used : TableName(org.apache.hadoop.hbase.TableName) RegionLocations(org.apache.hadoop.hbase.RegionLocations) Locator(org.apache.hadoop.hbase.client.RegionReplicaTestHelper.Locator) RegionReplicaTestHelper.testLocator(org.apache.hadoop.hbase.client.RegionReplicaTestHelper.testLocator) HRegionLocation(org.apache.hadoop.hbase.HRegionLocation) TableNotFoundException(org.apache.hadoop.hbase.TableNotFoundException) NotServingRegionException(org.apache.hadoop.hbase.NotServingRegionException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)1 ExecutionException (java.util.concurrent.ExecutionException)1 HRegionLocation (org.apache.hadoop.hbase.HRegionLocation)1 NotServingRegionException (org.apache.hadoop.hbase.NotServingRegionException)1 RegionLocations (org.apache.hadoop.hbase.RegionLocations)1 TableName (org.apache.hadoop.hbase.TableName)1 TableNotFoundException (org.apache.hadoop.hbase.TableNotFoundException)1 Locator (org.apache.hadoop.hbase.client.RegionReplicaTestHelper.Locator)1 RegionReplicaTestHelper.testLocator (org.apache.hadoop.hbase.client.RegionReplicaTestHelper.testLocator)1 Test (org.junit.Test)1