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);
}
}
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);
}
}
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);
}
}
Aggregations