private static HColumnDescriptor newFamilyDescriptor(String family) { HColumnDescriptor fd = new HColumnDescriptor(family); fd.setInMemory(true); // metadata tables are best in memory return fd; }
/** * Create an HTableDescriptor from provided TestOptions. */ protected static HTableDescriptor getTableDescriptor(TestOptions opts) { HTableDescriptor tableDesc = new HTableDescriptor(TableName.valueOf(opts.tableName)); for (int family = 0; family < opts.families; family++) { byte[] familyName = Bytes.toBytes(FAMILY_NAME_BASE + family); HColumnDescriptor familyDesc = new HColumnDescriptor(familyName); familyDesc.setDataBlockEncoding(opts.blockEncoding); familyDesc.setCompressionType(opts.compression); familyDesc.setBloomFilterType(opts.bloomType); familyDesc.setBlocksize(opts.blockSize); if (opts.inMemoryCF) { familyDesc.setInMemory(true); } familyDesc.setInMemoryCompaction(opts.inMemoryCompaction); tableDesc.addFamily(familyDesc); } if (opts.replicas != DEFAULT_OPTS.replicas) { tableDesc.setRegionReplication(opts.replicas); } if (opts.splitPolicy != null && !opts.splitPolicy.equals(DEFAULT_OPTS.splitPolicy)) { tableDesc.setRegionSplitPolicyClassName(opts.splitPolicy); } return tableDesc; }
protected HTableDescriptor getTableDescriptor() { if (TABLE_DESCRIPTOR == null) { TABLE_DESCRIPTOR = new HTableDescriptor(tableName); HColumnDescriptor family = new HColumnDescriptor(FAMILY_NAME); family.setDataBlockEncoding(blockEncoding); family.setCompressionType(compression); if (inMemoryCF) { family.setInMemory(true); } TABLE_DESCRIPTOR.addFamily(family); } return TABLE_DESCRIPTOR; }
/** * This utility method creates a new Hbase HColumnDescriptor object based on a * Thrift ColumnDescriptor "struct". * * @param in Thrift ColumnDescriptor object * @return HColumnDescriptor * @throws IllegalArgument if the column name is empty */ static public HColumnDescriptor colDescFromThrift(ColumnDescriptor in) throws IllegalArgument { Compression.Algorithm comp = Compression.getCompressionAlgorithmByName(in.compression.toLowerCase(Locale.ROOT)); BloomType bt = BloomType.valueOf(in.bloomFilterType); if (in.name == null || !in.name.hasRemaining()) { throw new IllegalArgument("column name is empty"); } byte [] parsedName = CellUtil.parseColumn(Bytes.getBytes(in.name))[0]; HColumnDescriptor col = new HColumnDescriptor(parsedName) .setMaxVersions(in.maxVersions) .setCompressionType(comp) .setInMemory(in.inMemory) .setBlockCacheEnabled(in.blockCacheEnabled) .setTimeToLive(in.timeToLive > 0 ? in.timeToLive : Integer.MAX_VALUE) .setBloomFilterType(bt); return col; }
cf.setInMemory(false); cf.setBloomFilterType(BloomType.NONE); cf.setScope(kylinConfig.getHBaseReplicationScope());
for (String family : families) { HColumnDescriptor fd = new HColumnDescriptor(family); fd.setInMemory(true); // metadata tables are best in memory desc.addFamily(fd);
HColumnDescriptor hcd = new HColumnDescriptor( new HColumnDescriptor(HConstants.CATALOG_FAMILY) .setInMemory(true) .setScope(HConstants.REPLICATION_SCOPE_LOCAL) .setBloomFilterType(BloomType.NONE) assertEquals(v, hcd.getMinVersions()); hcd.setKeepDeletedCells(KeepDeletedCells.TRUE); hcd.setInMemory(!HColumnDescriptor.DEFAULT_IN_MEMORY); boolean inmemory = hcd.isInMemory(); hcd.setScope(v);
cf.setInMemory(false); cf.setBlocksize(4 * 1024 * 1024); // set to 4MB tableDesc.addFamily(cf);
@Test public void testCreateHtable() throws IOException { HTableDescriptor tableDesc = new HTableDescriptor(TableName.valueOf("testhbase")); tableDesc.setValue("KYLIN_HOST", "dev01"); HColumnDescriptor cf = new HColumnDescriptor("f"); cf.setMaxVersions(1); cf.setInMemory(true); cf.setBlocksize(4 * 1024 * 1024); // set to 4MB tableDesc.addFamily(cf); Configuration conf = HBaseConfiguration.create(); HBaseAdmin admin = new HBaseAdmin(conf); admin.createTable(tableDesc); admin.close(); }
private static HColumnDescriptor newFamilyDescriptor(String family) { HColumnDescriptor fd = new HColumnDescriptor(family); fd.setInMemory(true); // metadata tables are best in memory return fd; }
HTableDescriptor descriptor = new HTableDescriptor("Student92"); HColumnDescriptor col1=new HColumnDescriptor("No".getBytes()); HColumnDescriptor col2=new HColumnDescriptor("Subject".getBytes()); col1.setInMemory(true); col2.setInMemory(true);
private HColumnDescriptor getColumnDesc(byte[] columnFamily) { HColumnDescriptor family = new HColumnDescriptor(columnFamily); family.setMaxVersions(1); family.setCompressionType(Compression.Algorithm.LZO); family.setInMemory(false); return family; }
protected static HColumnDescriptor createLockFamily() { HColumnDescriptor desc = new HColumnDescriptor(ColumnUtil.LOCK_FAMILY_NAME); desc.setInMemory(true); desc.setMaxVersions(1); desc.setTimeToLive(HConstants.FOREVER); // TODO(cuijianwei) : choose the best bloom filter type // desc.setBloomFilterType(BloomType.ROWCOL); return desc; }
public FamilyAdmin inMemory() { HColumnDescriptor columnDescriptor = desc.getFamily(familyName); if (!columnDescriptor.isInMemory()) { LOG.info("Setting family [" + Bytes.toString(familyName) + "] to be in memory family."); disableTable(); columnDescriptor.setInMemory(true); desc.addFamily(columnDescriptor); return modifyAndEnable(); } LOG.info("Family [" + Bytes.toString(familyName) + "] is in memory family."); return this; }
private HTableInterface createSchemaTable() throws AvroBaseException { HTableInterface schemaTable; HColumnDescriptor family = new HColumnDescriptor(AVRO_FAMILY); family.setMaxVersions(1); family.setCompressionType(Compression.Algorithm.LZO); family.setInMemory(true); HTableDescriptor tableDesc = new HTableDescriptor(schemaName); tableDesc.addFamily(family); try { admin.createTable(tableDesc); } catch (IOException e1) { throw new AvroBaseException(e1); } schemaTable = pool.getTable(schemaName); return schemaTable; }
protected HTableDescriptor getTableDescriptor() { if (TABLE_DESCRIPTOR == null) { TABLE_DESCRIPTOR = new HTableDescriptor(tableName); HColumnDescriptor family = new HColumnDescriptor(FAMILY_NAME); family.setDataBlockEncoding(blockEncoding); family.setCompressionType(compression); if (inMemoryCF) { family.setInMemory(true); } TABLE_DESCRIPTOR.addFamily(family); } return TABLE_DESCRIPTOR; }
/** * Enable in memory caching for .META. */ public static void setInfoFamilyCachingForMeta(final boolean b) { for (HColumnDescriptor hcd: HTableDescriptor.META_TABLEDESC.getColumnFamilies()) { if (Bytes.equals(hcd.getName(), HConstants.CATALOG_FAMILY)) { hcd.setBlockCacheEnabled(b); hcd.setInMemory(b); } } }
/** * Enable in-memory caching for -ROOT- */ public static void setInfoFamilyCachingForRoot(final boolean b) { for (HColumnDescriptor hcd: HTableDescriptor.ROOT_TABLEDESC.getColumnFamilies()) { if (Bytes.equals(hcd.getName(), HConstants.CATALOG_FAMILY)) { hcd.setBlockCacheEnabled(b); hcd.setInMemory(b); } } }
/** * Enable in memory caching for hbase:meta */ public static void setInfoFamilyCachingForMeta(final HTableDescriptor metaDescriptor, final boolean b) { for (HColumnDescriptor hcd: metaDescriptor.getColumnFamilies()) { if (Bytes.equals(hcd.getName(), HConstants.CATALOG_FAMILY)) { hcd.setBlockCacheEnabled(b); hcd.setInMemory(b); } } }
HColumnDescriptor hcd = new HColumnDescriptor( new HColumnDescriptor(HConstants.CATALOG_FAMILY) .setInMemory(true) .setScope(HConstants.REPLICATION_SCOPE_LOCAL) .setBloomFilterType(BloomType.NONE) assertEquals(v, hcd.getMinVersions()); hcd.setKeepDeletedCells(KeepDeletedCells.TRUE); hcd.setInMemory(!HColumnDescriptor.DEFAULT_IN_MEMORY); boolean inmemory = hcd.isInMemory(); hcd.setScope(v);