Description
In the MiniCluster test environment, an NPE occurs while scanning regions
of a pre-split table with multiple column families. Without this working
in the test environment, you cannot write unit tests for these types of
scenarios.
Add the following to TestMetaScanner to repro:
@Test
public void testMultiFamilyMultiRegionMetaScanner() throws Exception {
LOG.info("Starting testMetaScanner");
final byte[] TABLENAME = Bytes.toBytes("testMetaScanner");
final byte[] FAMILY1 = Bytes.toBytes("family1");
final byte[] FAMILY2 = Bytes.toBytes("family2");
TEST_UTIL.createTable(TABLENAME, new byte[][]
);
Configuration conf = TEST_UTIL.getConfiguration();
HTable table = new HTable(conf, TABLENAME);
TEST_UTIL.createMultiRegions(conf, table, FAMILY1,
new byte[][]
);
TEST_UTIL.createMultiRegions(conf, table, FAMILY2,
new byte[][]
);
// Make sure all the regions are deployed
TEST_UTIL.countRows(table);
// This fails with an NPE currently
MetaScanner.allTableRegions(conf, TABLENAME, false).keySet();
table.close();
}