Пример #1
0
  public void applyToCFMetadata(CFMetaData cfm) throws ConfigurationException, SyntaxException {
    if (hasProperty(KW_COMMENT)) cfm.comment(getString(KW_COMMENT, ""));

    cfm.readRepairChance(getDouble(KW_READREPAIRCHANCE, cfm.getReadRepairChance()));
    cfm.dcLocalReadRepairChance(getDouble(KW_DCLOCALREADREPAIRCHANCE, cfm.getDcLocalReadRepair()));
    cfm.gcGraceSeconds(getInt(KW_GCGRACESECONDS, cfm.getGcGraceSeconds()));
    int minCompactionThreshold =
        toInt(
            KW_MINCOMPACTIONTHRESHOLD,
            getCompactionOptions().get(KW_MINCOMPACTIONTHRESHOLD),
            cfm.getMinCompactionThreshold());
    int maxCompactionThreshold =
        toInt(
            KW_MAXCOMPACTIONTHRESHOLD,
            getCompactionOptions().get(KW_MAXCOMPACTIONTHRESHOLD),
            cfm.getMaxCompactionThreshold());
    if (minCompactionThreshold <= 0 || maxCompactionThreshold <= 0)
      throw new ConfigurationException(
          "Disabling compaction by setting compaction thresholds to 0 has been deprecated, set the compaction option 'enabled' to false instead.");
    cfm.minCompactionThreshold(minCompactionThreshold);
    cfm.maxCompactionThreshold(maxCompactionThreshold);
    cfm.defaultTimeToLive(getInt(KW_DEFAULT_TIME_TO_LIVE, cfm.getDefaultTimeToLive()));
    cfm.speculativeRetry(
        CFMetaData.SpeculativeRetry.fromString(
            getString(KW_SPECULATIVE_RETRY, cfm.getSpeculativeRetry().toString())));
    cfm.memtableFlushPeriod(getInt(KW_MEMTABLE_FLUSH_PERIOD, cfm.getMemtableFlushPeriod()));
    cfm.minIndexInterval(getInt(KW_MIN_INDEX_INTERVAL, cfm.getMinIndexInterval()));
    cfm.maxIndexInterval(getInt(KW_MAX_INDEX_INTERVAL, cfm.getMaxIndexInterval()));

    if (compactionStrategyClass != null) {
      cfm.compactionStrategyClass(compactionStrategyClass);
      cfm.compactionStrategyOptions(new HashMap<>(getCompactionOptions()));
    }

    cfm.bloomFilterFpChance(getDouble(KW_BF_FP_CHANCE, cfm.getBloomFilterFpChance()));

    if (!getCompressionOptions().isEmpty())
      cfm.compressionParameters(CompressionParameters.create(getCompressionOptions()));
    CachingOptions cachingOptions = getCachingOptions();
    if (cachingOptions != null) cfm.caching(cachingOptions);
  }