當前位置: 首頁>>代碼示例>>Java>>正文


Java HColumnDescriptor.getTimeToLive方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.HColumnDescriptor.getTimeToLive方法的典型用法代碼示例。如果您正苦於以下問題:Java HColumnDescriptor.getTimeToLive方法的具體用法?Java HColumnDescriptor.getTimeToLive怎麽用?Java HColumnDescriptor.getTimeToLive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.HColumnDescriptor的用法示例。


在下文中一共展示了HColumnDescriptor.getTimeToLive方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: determineTTLFromFamily

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
/**
 * @param family
 * @return TTL in seconds of the specified family
 */
private static long determineTTLFromFamily(final HColumnDescriptor family) {
  // HCD.getTimeToLive returns ttl in seconds. Convert to milliseconds.
  long ttl = family.getTimeToLive();
  if (ttl == HConstants.FOREVER) {
    // Default is unlimited ttl.
    ttl = Long.MAX_VALUE;
  } else if (ttl == -1) {
    ttl = Long.MAX_VALUE;
  } else {
    // Second -> ms adjust for user data
    ttl *= 1000;
  }
  return ttl;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:HStore.java

示例2: checkCompactionPolicy

import org.apache.hadoop.hbase.HColumnDescriptor; //導入方法依賴的package包/類
private void checkCompactionPolicy(Configuration conf, HTableDescriptor htd)
    throws IOException {
  // FIFO compaction has some requirements
  // Actually FCP ignores periodic major compactions
  String className =
      htd.getConfigurationValue(DefaultStoreEngine.DEFAULT_COMPACTION_POLICY_CLASS_KEY);
  if (className == null) {
    className =
        conf.get(DefaultStoreEngine.DEFAULT_COMPACTION_POLICY_CLASS_KEY,
          ExploringCompactionPolicy.class.getName());
  }

  int blockingFileCount = HStore.DEFAULT_BLOCKING_STOREFILE_COUNT;
  String sv = htd.getConfigurationValue(HStore.BLOCKING_STOREFILES_KEY);
  if (sv != null) {
    blockingFileCount = Integer.parseInt(sv);
  } else {
    blockingFileCount = conf.getInt(HStore.BLOCKING_STOREFILES_KEY, blockingFileCount);
  }

  for (HColumnDescriptor hcd : htd.getColumnFamilies()) {
    String compactionPolicy =
        hcd.getConfigurationValue(DefaultStoreEngine.DEFAULT_COMPACTION_POLICY_CLASS_KEY);
    if (compactionPolicy == null) {
      compactionPolicy = className;
    }
    if (!compactionPolicy.equals(FIFOCompactionPolicy.class.getName())) {
      continue;
    }
    // FIFOCompaction
    String message = null;

    // 1. Check TTL
    if (hcd.getTimeToLive() == HColumnDescriptor.DEFAULT_TTL) {
      message = "Default TTL is not supported for FIFO compaction";
      throw new IOException(message);
    }

    // 2. Check min versions
    if (hcd.getMinVersions() > 0) {
      message = "MIN_VERSION > 0 is not supported for FIFO compaction";
      throw new IOException(message);
    }

    // 3. blocking file count
    String sbfc = htd.getConfigurationValue(HStore.BLOCKING_STOREFILES_KEY);
    if (sbfc != null) {
      blockingFileCount = Integer.parseInt(sbfc);
    }
    if (blockingFileCount < 1000) {
      message =
          "blocking file count '" + HStore.BLOCKING_STOREFILES_KEY + "' " + blockingFileCount
              + " is below recommended minimum of 1000";
      throw new IOException(message);
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:58,代碼來源:HMaster.java


注:本文中的org.apache.hadoop.hbase.HColumnDescriptor.getTimeToLive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。