@Test(expected=IllegalArgumentException.class) public void testModifyInexistentFamily() { HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name.getMethodName())); byte[] familyName = Bytes.toBytes("cf"); HColumnDescriptor hcd = new HColumnDescriptor(familyName); htd.modifyFamily(hcd); }
private void alterForPolicyTest(final MobCompactPartitionPolicy type) throws Exception { hcd1.setMobCompactPartitionPolicy(type); desc.modifyFamily(hcd1); admin.modifyTable(tableName, desc); Pair<Integer, Integer> st; while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) { LOG.debug(st.getFirst() + " regions left to update"); Thread.sleep(40); } LOG.info("alter status finished"); }
HColumnDescriptor hcd = new HColumnDescriptor(fam1); if (htd.hasFamily(hcd.getName())) { htd.modifyFamily(hcd); } else { htd.addFamily(hcd);
private void init(Configuration conf, long mobThreshold) throws Exception { this.conf = conf; this.mobCellThreshold = mobThreshold; HBaseTestingUtility UTIL = new HBaseTestingUtility(conf); compactionThreshold = conf.getInt("hbase.hstore.compactionThreshold", 3); htd = UTIL.createTableDescriptor(name.getMethodName()); hcd = new HColumnDescriptor(COLUMN_FAMILY); hcd.setMobEnabled(true); hcd.setMobThreshold(mobThreshold); hcd.setMaxVersions(1); htd.modifyFamily(hcd); RegionInfo regionInfo = RegionInfoBuilder.newBuilder(htd.getTableName()).build(); region = HBaseTestingUtility .createRegionAndWAL(regionInfo, UTIL.getDataTestDir(), conf, htd, new MobFileCache(conf)); fs = FileSystem.get(conf); }
@Test public void testModifyFamily() { HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name.getMethodName())); byte[] familyName = Bytes.toBytes("cf"); HColumnDescriptor hcd = new HColumnDescriptor(familyName); hcd.setBlocksize(1000); hcd.setDFSReplication((short) 3); htd.addFamily(hcd); assertEquals(1000, htd.getFamily(familyName).getBlocksize()); assertEquals(3, htd.getFamily(familyName).getDFSReplication()); hcd = new HColumnDescriptor(familyName); hcd.setBlocksize(2000); hcd.setDFSReplication((short) 1); htd.modifyFamily(hcd); assertEquals(2000, htd.getFamily(familyName).getBlocksize()); assertEquals(1, htd.getFamily(familyName).getDFSReplication()); }
HColumnDescriptor hcd = new HColumnDescriptor(fam1); if (htd.hasFamily(hcd.getName())) { htd.modifyFamily(hcd); } else { htd.addFamily(hcd);
HColumnDescriptor hcd = new HColumnDescriptor(htd.getFamily(FAMILY)); hcd.setValue("hbase.hstore.compaction.min", String.valueOf(2)); htd.modifyFamily(hcd); admin.modifyTable(tableName, htd); while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) { hcd = new HColumnDescriptor(htd.getFamily(FAMILY)); hcd.setValue("hbase.hstore.compaction.min", null); htd.modifyFamily(hcd); admin.modifyTable(tableName, htd); while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {
@Test(expected=IllegalArgumentException.class) public void testModifyInexistentFamily() { HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name.getMethodName())); byte[] familyName = Bytes.toBytes("cf"); HColumnDescriptor hcd = new HColumnDescriptor(familyName); htd.modifyFamily(hcd); }
@Test public void testModifyFamily() { HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(name.getMethodName())); byte[] familyName = Bytes.toBytes("cf"); HColumnDescriptor hcd = new HColumnDescriptor(familyName); hcd.setBlocksize(1000); hcd.setDFSReplication((short) 3); htd.addFamily(hcd); assertEquals(1000, htd.getFamily(familyName).getBlocksize()); assertEquals(3, htd.getFamily(familyName).getDFSReplication()); hcd = new HColumnDescriptor(familyName); hcd.setBlocksize(2000); hcd.setDFSReplication((short) 1); htd.modifyFamily(hcd); assertEquals(2000, htd.getFamily(familyName).getBlocksize()); assertEquals(1, htd.getFamily(familyName).getDFSReplication()); }
private void alterForPolicyTest(final MobCompactPartitionPolicy type) throws Exception { hcd1.setMobCompactPartitionPolicy(type); desc.modifyFamily(hcd1); admin.modifyTable(tableName, desc); Pair<Integer, Integer> st; while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) { LOG.debug(st.getFirst() + " regions left to update"); Thread.sleep(40); } LOG.info("alter status finished"); }
private void init(Configuration conf, long mobThreshold) throws Exception { this.conf = conf; this.mobCellThreshold = mobThreshold; HBaseTestingUtility UTIL = new HBaseTestingUtility(conf); compactionThreshold = conf.getInt("hbase.hstore.compactionThreshold", 3); htd = UTIL.createTableDescriptor(name.getMethodName()); hcd = new HColumnDescriptor(COLUMN_FAMILY); hcd.setMobEnabled(true); hcd.setMobThreshold(mobThreshold); hcd.setMaxVersions(1); htd.modifyFamily(hcd); region = UTIL.createLocalHRegion(htd, null, null); fs = FileSystem.get(conf); }
/** * Modify the column family from the file system */ private void updateTableDescriptor(final MasterProcedureEnv env) throws IOException { // Update table descriptor LOG.info("ModifyColumnFamily. Table = " + tableName + " HCD = " + cfDescriptor.toString()); HTableDescriptor htd = env.getMasterServices().getTableDescriptors().get(tableName); htd.modifyFamily(cfDescriptor); env.getMasterServices().getTableDescriptors().add(htd); }
/** * Modify Column of a table * @param tableName * @param hcd HColumnDesciptor * @return Modified HTableDescriptor with the column modified. * @throws IOException */ public HTableDescriptor modifyColumn(TableName tableName, HColumnDescriptor hcd) throws IOException { LOG.info("AddModifyColumn. Table = " + tableName + " HCD = " + hcd.toString()); HTableDescriptor htd = this.services.getTableDescriptors().get(tableName); byte [] familyName = hcd.getName(); if(!htd.hasFamily(familyName)) { throw new InvalidFamilyOperationException("Family '" + Bytes.toString(familyName) + "' doesn't exists so cannot be modified"); } htd.modifyFamily(hcd); this.services.getTableDescriptors().add(htd); return htd; }
HColumnDescriptor hcd = new HColumnDescriptor(fam1); if (htd.hasFamily(hcd.getName())) { htd.modifyFamily(hcd); } else { htd.addFamily(hcd);
HColumnDescriptor hcd = new HColumnDescriptor(fam1); if (htd.hasFamily(hcd.getName())) { htd.modifyFamily(hcd); } else { htd.addFamily(hcd);
HColumnDescriptor hcd = new HColumnDescriptor(htd.getFamily(FAMILY)); hcd.setValue("hbase.hstore.compaction.min", String.valueOf(2)); htd.modifyFamily(hcd); admin.modifyTable(tableName, htd); while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) { hcd = new HColumnDescriptor(htd.getFamily(FAMILY)); hcd.setValue("hbase.hstore.compaction.min", null); htd.modifyFamily(hcd); admin.modifyTable(tableName, htd); while (null != (st = admin.getAlterStatus(tableName)) && st.getFirst() > 0) {