Java Code Examples for org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder#setMaxVersions()
The following examples show how to use
org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder#setMaxVersions() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransactionProcessorTest.java From phoenix-tephra with Apache License 2.0 | 6 votes |
private HRegion updateTtl(HRegion region, byte[] family, long ttl) throws Exception { region.close(); TableDescriptorBuilder tableBuilder = TableDescriptorBuilder.newBuilder(region.getTableDescriptor()); ColumnFamilyDescriptorBuilder cfd = ColumnFamilyDescriptorBuilder.newBuilder(tableBuilder.build().getColumnFamily(family)); if (ttl > 0) { cfd.setValue(Bytes.toBytes(TxConstants.PROPERTY_TTL), Bytes.toBytes(String.valueOf(ttl))); } cfd.setMaxVersions(10); tableBuilder.removeColumnFamily(family); tableBuilder.addColumnFamily(cfd.build()); return HRegion .openHRegion(region.getRegionInfo(), tableBuilder.build(), region.getWAL(), conf, new LocalRegionServerServices(conf, ServerName .valueOf(InetAddress.getLocalHost().getHostName(), 0, System.currentTimeMillis())), null); }
Example 2
Source File: BackupSystemTable.java From hbase with Apache License 2.0 | 6 votes |
/** * Get backup system table descriptor * @return table's descriptor */ public static TableDescriptor getSystemTableDescriptor(Configuration conf) { TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(getTableName(conf)); ColumnFamilyDescriptorBuilder colBuilder = ColumnFamilyDescriptorBuilder.newBuilder(SESSIONS_FAMILY); colBuilder.setMaxVersions(1); Configuration config = HBaseConfiguration.create(); int ttl = config.getInt(BackupRestoreConstants.BACKUP_SYSTEM_TTL_KEY, BackupRestoreConstants.BACKUP_SYSTEM_TTL_DEFAULT); colBuilder.setTimeToLive(ttl); ColumnFamilyDescriptor colSessionsDesc = colBuilder.build(); builder.setColumnFamily(colSessionsDesc); colBuilder = ColumnFamilyDescriptorBuilder.newBuilder(META_FAMILY); colBuilder.setTimeToLive(ttl); builder.setColumnFamily(colBuilder.build()); return builder.build(); }
Example 3
Source File: BackupSystemTable.java From hbase with Apache License 2.0 | 6 votes |
/** * Get backup system table descriptor * @return table's descriptor */ public static TableDescriptor getSystemTableForBulkLoadedDataDescriptor(Configuration conf) { TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(getTableNameForBulkLoadedData(conf)); ColumnFamilyDescriptorBuilder colBuilder = ColumnFamilyDescriptorBuilder.newBuilder(SESSIONS_FAMILY); colBuilder.setMaxVersions(1); Configuration config = HBaseConfiguration.create(); int ttl = config.getInt(BackupRestoreConstants.BACKUP_SYSTEM_TTL_KEY, BackupRestoreConstants.BACKUP_SYSTEM_TTL_DEFAULT); colBuilder.setTimeToLive(ttl); ColumnFamilyDescriptor colSessionsDesc = colBuilder.build(); builder.setColumnFamily(colSessionsDesc); colBuilder = ColumnFamilyDescriptorBuilder.newBuilder(META_FAMILY); colBuilder.setTimeToLive(ttl); builder.setColumnFamily(colBuilder.build()); return builder.build(); }
Example 4
Source File: TestVisibilityLabelsWithDeletes.java From hbase with Apache License 2.0 | 5 votes |
private void createTable(TableName tableName, int maxVersions) throws IOException { ColumnFamilyDescriptorBuilder builder = ColumnFamilyDescriptorBuilder.newBuilder(fam); if (maxVersions > 0) { builder.setMaxVersions(maxVersions); } TEST_UTIL.getAdmin().createTable( TableDescriptorBuilder.newBuilder(tableName).setColumnFamily(builder.build()).build()); }
Example 5
Source File: IntegrationTestMTTR.java From hbase with Apache License 2.0 | 5 votes |
private static void setupTables() throws IOException { // Get the table name. tableName = TableName.valueOf(util.getConfiguration() .get("hbase.IntegrationTestMTTR.tableName", "IntegrationTestMTTR")); loadTableName = TableName.valueOf(util.getConfiguration() .get("hbase.IntegrationTestMTTR.loadTableName", "IntegrationTestMTTRLoadTestTool")); if (util.getAdmin().tableExists(tableName)) { util.deleteTable(tableName); } if (util.getAdmin().tableExists(loadTableName)) { util.deleteTable(loadTableName); } // Create the table. If this fails then fail everything. TableDescriptor tableDescriptor = util.getAdmin().getDescriptor(tableName); TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(tableDescriptor); // Make the max file size huge so that splits don't happen during the test. builder.setMaxFileSize(Long.MAX_VALUE); ColumnFamilyDescriptorBuilder colDescriptorBldr = ColumnFamilyDescriptorBuilder.newBuilder(FAMILY); colDescriptorBldr.setMaxVersions(1); builder.setColumnFamily(colDescriptorBldr.build()); util.getAdmin().createTable(builder.build()); // Setup the table for LoadTestTool int ret = loadTool.run(new String[]{"-tn", loadTableName.getNameAsString(), "-init_only"}); assertEquals("Failed to initialize LoadTestTool", 0, ret); }
Example 6
Source File: ThriftUtilities.java From hbase with Apache License 2.0 | 4 votes |
public static ColumnFamilyDescriptor columnFamilyDescriptorFromThrift( TColumnFamilyDescriptor in) { ColumnFamilyDescriptorBuilder builder = ColumnFamilyDescriptorBuilder .newBuilder(in.getName()); if (in.isSetAttributes()) { for (Map.Entry<ByteBuffer, ByteBuffer> attribute : in.getAttributes().entrySet()) { builder.setValue(attribute.getKey().array(), attribute.getValue().array()); } } if (in.isSetConfiguration()) { for (Map.Entry<String, String> conf : in.getConfiguration().entrySet()) { builder.setConfiguration(conf.getKey(), conf.getValue()); } } if (in.isSetBlockSize()) { builder.setBlocksize(in.getBlockSize()); } if (in.isSetBloomnFilterType()) { builder.setBloomFilterType(bloomFilterFromThrift(in.getBloomnFilterType())); } if (in.isSetCompressionType()) { builder.setCompressionType(compressionAlgorithmFromThrift(in.getCompressionType())); } if (in.isSetDfsReplication()) { builder.setDFSReplication(in.getDfsReplication()); } if (in.isSetDataBlockEncoding()) { builder.setDataBlockEncoding(dataBlockEncodingFromThrift(in.getDataBlockEncoding())); } if (in.isSetKeepDeletedCells()) { builder.setKeepDeletedCells(keepDeletedCellsFromThrift(in.getKeepDeletedCells())); } if (in.isSetMaxVersions()) { builder.setMaxVersions(in.getMaxVersions()); } if (in.isSetMinVersions()) { builder.setMinVersions(in.getMinVersions()); } if (in.isSetScope()) { builder.setScope(in.getScope()); } if (in.isSetTimeToLive()) { builder.setTimeToLive(in.getTimeToLive()); } if (in.isSetBlockCacheEnabled()) { builder.setBlockCacheEnabled(in.isBlockCacheEnabled()); } if (in.isSetCacheBloomsOnWrite()) { builder.setCacheBloomsOnWrite(in.isCacheBloomsOnWrite()); } if (in.isSetCacheDataOnWrite()) { builder.setCacheDataOnWrite(in.isCacheDataOnWrite()); } if (in.isSetCacheIndexesOnWrite()) { builder.setCacheIndexesOnWrite(in.isCacheIndexesOnWrite()); } if (in.isSetCompressTags()) { builder.setCompressTags(in.isCompressTags()); } if (in.isSetEvictBlocksOnClose()) { builder.setEvictBlocksOnClose(in.isEvictBlocksOnClose()); } if (in.isSetInMemory()) { builder.setInMemory(in.isInMemory()); } return builder.build(); }