@Override public Void call() throws Exception { LOG.info("Upgrading queue table: {}", tableId); Properties properties = new Properties(); HTableDescriptor desc = tableUtil.getHTableDescriptor(admin, tableId); if (desc.getValue(HBaseQueueAdmin.PROPERTY_PREFIX_BYTES) == null) { // It's the old queue table. Set the property prefix bytes to SALT_BYTES properties.setProperty(HBaseQueueAdmin.PROPERTY_PREFIX_BYTES, Integer.toString(SaltedHBaseQueueStrategy.SALT_BYTES)); } upgrade(tableId, properties); LOG.info("Upgraded queue table: {}", tableId); return null; } };
private HTableDescriptor getTableDescriptor(String namespace, String name) throws IOException { HBaseTableUtil tableUtil = getTableUtil(); TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), name); return getTableUtil().getHTableDescriptor(hAdmin, hTableId); }
tableDescriptor = tableUtil.getHTableDescriptor(admin, tableId);
tableDescriptor = tableUtil.getHTableDescriptor(admin, tableId);
tableDescriptor = tableUtil.getHTableDescriptor(admin, tableId);
tableDescriptor = tableUtil.getHTableDescriptor(admin, tableId);
@Test public void testHTableDescriptor() throws IOException { HBaseTableUtil tableUtil = getTableUtil(); TableId tableId = TableId.from("default", "test.dataset"); create(tableId); HTableDescriptor tableDescriptor = tableUtil.getHTableDescriptor(hAdmin, tableId); Assert.assertEquals(ProjectInfo.getVersion().toString(), tableDescriptor.getValue(HBaseTableUtil.CDAP_VERSION)); Assert.assertEquals(getPrefix(), tableDescriptor.getValue(Constants.Dataset.TABLE_PREFIX)); TableName tableName = HTableNameConverter.toTableName(getPrefix(), tableId); ddlExecutor.disableTableIfEnabled(tableName.getNamespaceAsString(), tableName.getQualifierAsString()); tableUtil.deleteTable(ddlExecutor, tableId); }