Search in sources :

Example 1 with NormalizeTableFilterParams

use of org.apache.hadoop.hbase.client.NormalizeTableFilterParams in project hbase by apache.

the class TestSimpleRegionNormalizerOnCluster method testHonorsPatternFilter.

@Test
public void testHonorsPatternFilter() throws Exception {
    final TableName tn1 = TableName.valueOf(name.getMethodName() + "1");
    final TableName tn2 = TableName.valueOf(name.getMethodName() + "2");
    try {
        final int tn1RegionCount = createTableBegsSplit(tn1, true, false);
        final int tn2RegionCount = createTableBegsSplit(tn2, true, false);
        final NormalizeTableFilterParams ntfp = new NormalizeTableFilterParams.Builder().regex(".*[1]").build();
        assertFalse(admin.normalizerSwitch(true).get());
        assertTrue(admin.normalize(ntfp).get());
        waitForTableRegionCount(tn1, greaterThanOrEqualTo(tn1RegionCount + 1));
        // confirm that tn1 has (tn1RegionCount + 1) number of regions.
        // tn2 has tn2RegionCount number of regions because it fails filter.
        assertEquals(tn1 + " should have split.", tn1RegionCount + 1, getRegionCount(tn1));
        waitForTableRegionCount(tn2, comparesEqualTo(tn2RegionCount));
    } finally {
        dropIfExists(tn1);
        dropIfExists(tn2);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) NormalizeTableFilterParams(org.apache.hadoop.hbase.client.NormalizeTableFilterParams) TableDescriptorBuilder(org.apache.hadoop.hbase.client.TableDescriptorBuilder) Test(org.junit.Test)

Example 2 with NormalizeTableFilterParams

use of org.apache.hadoop.hbase.client.NormalizeTableFilterParams in project hbase by apache.

the class TestSimpleRegionNormalizerOnCluster method testHonorsNamespaceFilter.

@Test
public void testHonorsNamespaceFilter() throws Exception {
    final NamespaceDescriptor namespaceDescriptor = NamespaceDescriptor.create("ns").build();
    final TableName tn1 = TableName.valueOf("ns", name.getMethodName());
    final TableName tn2 = TableName.valueOf(name.getMethodName());
    try {
        admin.createNamespace(namespaceDescriptor).get();
        final int tn1RegionCount = createTableBegsSplit(tn1, true, false);
        final int tn2RegionCount = createTableBegsSplit(tn2, true, false);
        final NormalizeTableFilterParams ntfp = new NormalizeTableFilterParams.Builder().namespace("ns").build();
        assertFalse(admin.normalizerSwitch(true).get());
        assertTrue(admin.normalize(ntfp).get());
        waitForTableRegionCount(tn1, greaterThanOrEqualTo(tn1RegionCount + 1));
        // confirm that tn1 has (tn1RegionCount + 1) number of regions.
        // tn2 has tn2RegionCount number of regions because it's not a member of the target namespace.
        assertEquals(tn1 + " should have split.", tn1RegionCount + 1, getRegionCount(tn1));
        waitForTableRegionCount(tn2, comparesEqualTo(tn2RegionCount));
    } finally {
        dropIfExists(tn1);
        dropIfExists(tn2);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) NormalizeTableFilterParams(org.apache.hadoop.hbase.client.NormalizeTableFilterParams) TableDescriptorBuilder(org.apache.hadoop.hbase.client.TableDescriptorBuilder) NamespaceDescriptor(org.apache.hadoop.hbase.NamespaceDescriptor) Test(org.junit.Test)

Example 3 with NormalizeTableFilterParams

use of org.apache.hadoop.hbase.client.NormalizeTableFilterParams in project hbase by apache.

the class TestSimpleRegionNormalizerOnCluster method testHonorsNameFilter.

@Test
public void testHonorsNameFilter() throws Exception {
    final TableName tn1 = TableName.valueOf(name.getMethodName() + "1");
    final TableName tn2 = TableName.valueOf(name.getMethodName() + "2");
    try {
        final int tn1RegionCount = createTableBegsSplit(tn1, true, false);
        final int tn2RegionCount = createTableBegsSplit(tn2, true, false);
        final NormalizeTableFilterParams ntfp = new NormalizeTableFilterParams.Builder().tableNames(Collections.singletonList(tn1)).build();
        assertFalse(admin.normalizerSwitch(true).get());
        assertTrue(admin.normalize(ntfp).get());
        waitForTableRegionCount(tn1, greaterThanOrEqualTo(tn1RegionCount + 1));
        // confirm that tn1 has (tn1RegionCount + 1) number of regions.
        // tn2 has tn3RegionCount number of regions because it fails filter:
        assertEquals(tn1 + " should have split.", tn1RegionCount + 1, getRegionCount(tn1));
        waitForTableRegionCount(tn2, comparesEqualTo(tn2RegionCount));
    } finally {
        dropIfExists(tn1);
        dropIfExists(tn2);
    }
}
Also used : TableName(org.apache.hadoop.hbase.TableName) NormalizeTableFilterParams(org.apache.hadoop.hbase.client.NormalizeTableFilterParams) TableDescriptorBuilder(org.apache.hadoop.hbase.client.TableDescriptorBuilder) Test(org.junit.Test)

Aggregations

TableName (org.apache.hadoop.hbase.TableName)3 NormalizeTableFilterParams (org.apache.hadoop.hbase.client.NormalizeTableFilterParams)3 TableDescriptorBuilder (org.apache.hadoop.hbase.client.TableDescriptorBuilder)3 Test (org.junit.Test)3 NamespaceDescriptor (org.apache.hadoop.hbase.NamespaceDescriptor)1