Search in sources :

Example 1 with AbstractHBaseDataSetAdmin

use of io.cdap.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, HTableDescriptorBuilder descriptorBuilder) {
            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) HTableDescriptorBuilder(co.cask.cdap.data2.util.hbase.HTableDescriptorBuilder) AbstractHBaseDataSetAdmin(co.cask.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin) DatasetAdmin(co.cask.cdap.api.dataset.DatasetAdmin) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Example 2 with AbstractHBaseDataSetAdmin

use of io.cdap.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, HTableDescriptorBuilder descriptorBuilder) {
            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(io.cdap.cdap.data2.util.TableId) HTableDescriptorBuilder(io.cdap.cdap.data2.util.hbase.HTableDescriptorBuilder) AbstractHBaseDataSetAdmin(io.cdap.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin) DatasetAdmin(io.cdap.cdap.api.dataset.DatasetAdmin) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Example 3 with AbstractHBaseDataSetAdmin

use of io.cdap.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin in project cdap by cdapio.

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, HTableDescriptorBuilder descriptorBuilder) {
            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(io.cdap.cdap.data2.util.TableId) HTableDescriptorBuilder(io.cdap.cdap.data2.util.hbase.HTableDescriptorBuilder) AbstractHBaseDataSetAdmin(io.cdap.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin) DatasetAdmin(io.cdap.cdap.api.dataset.DatasetAdmin) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor)

Aggregations

HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)3 DatasetAdmin (io.cdap.cdap.api.dataset.DatasetAdmin)2 AbstractHBaseDataSetAdmin (io.cdap.cdap.data2.dataset2.lib.hbase.AbstractHBaseDataSetAdmin)2 TableId (io.cdap.cdap.data2.util.TableId)2 HTableDescriptorBuilder (io.cdap.cdap.data2.util.hbase.HTableDescriptorBuilder)2 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 HTableDescriptorBuilder (co.cask.cdap.data2.util.hbase.HTableDescriptorBuilder)1