meta.coprocessorProxy(AccessControllerProtocol.class, Bytes.toBytes("testModifyTable"));
protocol.grant(new UserPermission(Bytes.toBytes(TEST_USER.getShortName()), Bytes
.toBytes("testModifyTable"), null, Permission.Action.ADMIN, Permission.Action.CREATE));
HBaseAdmin admin = new HBaseAdmin(conf);
IndexedHTableDescriptor htd = new IndexedHTableDescriptor("testModifyTable");
HColumnDescriptor hcd = new HColumnDescriptor("cf");
htd.addFamily(hcd);
IndexSpecification iSpec = new IndexSpecification("spec");
iSpec.addIndexColumn(hcd, "q", ValueType.String, 10);
htd.addIndex(iSpec);
admin.createTable(htd);
ZKAssign.blockUntilNoRIT(HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL));
admin.disableTable("testModifyTable");
PrivilegedExceptionAction modifyIndexTable = new PrivilegedExceptionAction() {
@Override
public Object run() throws Exception {
HBaseAdmin admin = new HBaseAdmin(conf);
HTableDescriptor htd = new HTableDescriptor("testModifyTable_idx");
htd.addFamily(new HColumnDescriptor("d"));
htd.addFamily(new HColumnDescriptor("d1"));
admin.modifyTable(Bytes.toBytes("testModifyTable_idx"), htd);
return null;
}
};
PrivilegedExceptionAction modifyMainTable = new PrivilegedExceptionAction() {
@Override
public Object run() throws Exception {
HBaseAdmin admin = new HBaseAdmin(conf);
IndexedHTableDescriptor ihtd = new IndexedHTableDescriptor("testModifyTable");
HColumnDescriptor hcd = new HColumnDescriptor("cf");
HColumnDescriptor hcd1 = new HColumnDescriptor("cf1");
ihtd.addFamily(hcd);
ihtd.addFamily(hcd1);
IndexSpecification iSpec = new IndexSpecification("spec");
IndexSpecification iSpec1 = new IndexSpecification("spec1");
iSpec.addIndexColumn(hcd, "q", ValueType.String, 10);
iSpec1.addIndexColumn(hcd1, "q", ValueType.String, 10);
ihtd.addIndex(iSpec);
ihtd.addIndex(iSpec1);
admin.modifyTable(Bytes.toBytes("testModifyTable"), ihtd);
return null;
}
};