if (namespace.fromNamespaced(tableName) != null) {
System.out.println(String.format("Upgrading hbase table: %s, desc: %s", tableName, desc.toString()));
final boolean supportsIncrement =
"true".equalsIgnoreCase(desc.getValue(OrderedTable.PROPERTY_READLESS_INCREMENT));
DatasetAdmin admin = new AbstractHBaseDataSetAdmin(tableName, hConf, hBaseTableUtil) {
@Override
protected CoprocessorJar createCoprocessorJar() throws IOException {
return HBaseOrderedTableAdmin.createCoprocessorJarInternal(cConf,
injector.getInstance(LocationFactory.class),
hBaseTableUtil,
supportsIncrement);
}
@Override
protected boolean upgradeTable(HTableDescriptor tableDescriptor) {
// we don't do any other changes apart from coprocessors upgrade
return false;
}
@Override
public void create() throws IOException {
// no-op
throw new UnsupportedOperationException("This DatasetAdmin is only used for upgrade() operation");
}
};
admin.upgrade();
System.out.println(String.format("Upgraded hbase table: %s", tableName));
}
}
}