Java Code Examples for org.apache.hadoop.hbase.HColumnDescriptor.getName()

The following are Jave code examples for showing how to use getName() of the org.apache.hadoop.hbase.HColumnDescriptor class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File: MasterFileSystem.java   Source Code and License Vote up 6 votes
/**
 * 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;
}
 
Example 2
Project: ditb   File: TestCoprocessorScanPolicy.java   Source Code and License Vote up 6 votes
@Override
public InternalScanner preFlushScannerOpen(
    final ObserverContext<RegionCoprocessorEnvironment> c,
    Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException {
  Long newTtl = ttls.get(store.getTableName());
  if (newTtl != null) {
    System.out.println("PreFlush:" + newTtl);
  }
  Integer newVersions = versions.get(store.getTableName());
  ScanInfo oldSI = store.getScanInfo();
  HColumnDescriptor family = store.getFamily();
  ScanInfo scanInfo = new ScanInfo(TEST_UTIL.getConfiguration(),
      family.getName(), family.getMinVersions(),
      newVersions == null ? family.getMaxVersions() : newVersions,
      newTtl == null ? oldSI.getTtl() : newTtl, family.getKeepDeletedCells(),
      oldSI.getTimeToPurgeDeletes(), oldSI.getComparator());
  Scan scan = new Scan();
  scan.setMaxVersions(newVersions == null ? oldSI.getMaxVersions() : newVersions);
  return new StoreScanner(store, scanInfo, scan, Collections.singletonList(memstoreScanner),
      ScanType.COMPACT_RETAIN_DELETES, store.getSmallestReadPoint(),
      HConstants.OLDEST_TIMESTAMP);
}
 
Example 3
Project: ditb   File: TestCoprocessorScanPolicy.java   Source Code and License Vote up 6 votes
@Override
public InternalScanner preCompactScannerOpen(
    final ObserverContext<RegionCoprocessorEnvironment> c,
    Store store, List<? extends KeyValueScanner> scanners, ScanType scanType,
    long earliestPutTs, InternalScanner s) throws IOException {
  Long newTtl = ttls.get(store.getTableName());
  Integer newVersions = versions.get(store.getTableName());
  ScanInfo oldSI = store.getScanInfo();
  HColumnDescriptor family = store.getFamily();
  ScanInfo scanInfo = new ScanInfo(TEST_UTIL.getConfiguration(),
      family.getName(), family.getMinVersions(),
      newVersions == null ? family.getMaxVersions() : newVersions,
      newTtl == null ? oldSI.getTtl() : newTtl, family.getKeepDeletedCells(),
      oldSI.getTimeToPurgeDeletes(), oldSI.getComparator());
  Scan scan = new Scan();
  scan.setMaxVersions(newVersions == null ? oldSI.getMaxVersions() : newVersions);
  return new StoreScanner(store, scanInfo, scan, scanners, scanType,
      store.getSmallestReadPoint(), earliestPutTs);
}
 
Example 4
Project: ditb   File: TestCoprocessorScanPolicy.java   Source Code and License Vote up 6 votes
@Override
public KeyValueScanner preStoreScannerOpen(
    final ObserverContext<RegionCoprocessorEnvironment> c, Store store, final Scan scan,
    final NavigableSet<byte[]> targetCols, KeyValueScanner s) throws IOException {
  TableName tn = store.getTableName();
  if (!tn.isSystemTable()) {
    Long newTtl = ttls.get(store.getTableName());
    Integer newVersions = versions.get(store.getTableName());
    ScanInfo oldSI = store.getScanInfo();
    HColumnDescriptor family = store.getFamily();
    ScanInfo scanInfo = new ScanInfo(TEST_UTIL.getConfiguration(),
        family.getName(), family.getMinVersions(),
        newVersions == null ? family.getMaxVersions() : newVersions,
        newTtl == null ? oldSI.getTtl() : newTtl, family.getKeepDeletedCells(),
        oldSI.getTimeToPurgeDeletes(), oldSI.getComparator());
    return new StoreScanner(store, scanInfo, scan, targetCols,
        ((HStore) store).getHRegion().getReadpoint(IsolationLevel.READ_COMMITTED));
  } else {
    return s;
  }
}
 
Example 5
Project: ignite-hbase   File: AdminContext.java   Source Code and License Vote up 4 votes
private boolean hasFamily(HColumnDescriptor family, TableName table) throws IOException {
  byte[] familyName = family.getName();
  HTableDescriptor tableDescriptor = admin.getTableDescriptor(table);
  return tableDescriptor.hasFamily(familyName);
}
 
Example 6
Project: ditb   File: ScanInfo.java   Source Code and License Vote up 2 votes
/**
 * @param conf
 * @param family             {@link HColumnDescriptor} describing the column family
 * @param ttl                Store's TTL (in ms)
 * @param timeToPurgeDeletes duration in ms after which a delete marker can
 *                           be purged during a major compaction.
 * @param comparator         The store's comparator
 */
public ScanInfo(final Configuration conf, final HColumnDescriptor family, final long ttl,
    final long timeToPurgeDeletes, final KVComparator comparator) {
  this(conf, family.getName(), family.getMinVersions(), family.getMaxVersions(), ttl,
      family.getKeepDeletedCells(), timeToPurgeDeletes, comparator);
}