String userTableName = "testCoLocationFixing";
IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor(userTableName);
HColumnDescriptor hcd = new HColumnDescriptor("cf1");
ihtd.addFamily(hcd);
IndexSpecification iSpec = new IndexSpecification("idx");
iSpec.addIndexColumn(hcd, "q", ValueType.String, 10);
ihtd.addIndex(iSpec);
char c = 'A';
byte[][] splits = new byte[5][];
for (int i = 0; i < 5; i++) {
byte[] b = { (byte) c };
c++;
splits[i] = b;
}
admin.createTable(ihtd, splits);
String userTableName1 = "testCoLocationFixing1";
ihtd = new IndexedHTableDescriptor(userTableName1);
ihtd.addFamily(hcd);
iSpec = new IndexSpecification("idx1");
iSpec.addIndexColumn(hcd, "q", ValueType.String, 10);
ihtd.addIndex(iSpec);
admin.createTable(ihtd, splits);
String userTableName2 = "testCoLocationFixing2";
ihtd = new IndexedHTableDescriptor(userTableName2);
ihtd.addFamily(hcd);
iSpec = new IndexSpecification("idx2");
iSpec.addIndexColumn(hcd, "q", ValueType.String, 10);
ihtd.addIndex(iSpec);
admin.createTable(ihtd, splits);
List<byte[]> regions = UTIL.getMetaTableRows(Bytes.toBytes(userTableName + "_idx"));
List<byte[]> regionsEncod = getEncodedNames(regions);