Search in sources :

Example 1 with AbstractHBaseDataSetAdmin

use of co.cask.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin in project cdap by caskdata.

the class DatasetUpgrader method upgradeUserTable.

private void upgradeUserTable(HTableDescriptor desc) throws IOException {
    TableId tableId = HTableNameConverter.from(desc);
    LOG.info("Upgrading hbase table: {}, desc: {}", tableId, desc);
    final boolean supportsIncrement = HBaseTableAdmin.supportsReadlessIncrements(desc);
    final boolean transactional = HBaseTableAdmin.isTransactional(desc);
    DatasetAdmin admin = new AbstractHBaseDataSetAdmin(tableId, hConf, cConf, hBaseTableUtil, locationFactory) {

        @Override
        protected CoprocessorJar createCoprocessorJar() throws IOException {
            return HBaseTableAdmin.createCoprocessorJarInternal(cConf, coprocessorManager, hBaseTableUtil, transactional, supportsIncrement);
        }

        @Override
        protected boolean needsUpdate(HTableDescriptor tableDescriptor) {
            return false;
        }

        @Override
        public void create() throws IOException {
            // no-op
            throw new UnsupportedOperationException("This DatasetAdmin is only used for upgrade() operation");
        }
    };
    admin.upgrade();
    LOG.info("Upgraded hbase table: {}", tableId);
}
Also used : TableId(co.cask.cdap.data2.util.TableId) AbstractHBaseDataSetAdmin(co.cask.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin) DatasetAdmin(co.cask.cdap.api.dataset.DatasetAdmin) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Aggregations

DatasetAdmin (co.cask.cdap.api.dataset.DatasetAdmin)1 AbstractHBaseDataSetAdmin (co.cask.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin)1 TableId (co.cask.cdap.data2.util.TableId)1 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)1