iSpec.addIndexColumn(hcd, "ql", ValueType.String, 10);
ihtd.addIndex(iSpec);
admin.createTable(ihtd);
ZKAssign.blockUntilNoRIT(zkw);
IndexManager manager = IndexManager.getInstance();
int count = manager.getTableRegionCount(userTableName);
Assert.assertEquals(1, count);
HTable table = new HTable(conf, userTableName);
Put p = null;
for (int i = 0; i < 10; i++) {
p = new Put(Bytes.toBytes("row" + i));
p.add(Bytes.toBytes("col1"), Bytes.toBytes("ql"), Bytes.toBytes("test_val"));
table.put(p);
}
List<HRegion> regions = UTIL.getMiniHBaseCluster().getRegions(Bytes.toBytes(userTableName));
HRegionServer rs = UTIL.getMiniHBaseCluster().getRegionServer(0);
SplitTransaction st = null;
st = new MockedSplitTransaction(regions.get(0), null) {
@Override
protected void splitStoreFiles(final Path splitdir, final List<StoreFile> hstoreFilesToSplit)
throws IOException {
throw new IOException();
}
};
try {
st.execute(rs, rs);
} catch (IOException e) {
st.rollback(rs, rs);
}
count = manager.getTableRegionCount(userTableName);
Assert.assertEquals(1, count);
}