当前位置: 首页>>代码示例>>Java>>正文


Java Settings.getAsBytesSize方法代码示例

本文整理汇总了Java中org.elasticsearch.common.settings.Settings.getAsBytesSize方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getAsBytesSize方法的具体用法?Java Settings.getAsBytesSize怎么用?Java Settings.getAsBytesSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.settings.Settings的用法示例。


在下文中一共展示了Settings.getAsBytesSize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    String rateLimitingType = settings.get(INDICES_STORE_THROTTLE_TYPE,
            IndicesStore.this.settings.get(INDICES_STORE_THROTTLE_TYPE, DEFAULT_RATE_LIMITING_TYPE));
    // try and parse the type
    StoreRateLimiting.Type.fromString(rateLimitingType);
    if (!rateLimitingType.equals(IndicesStore.this.rateLimitingType)) {
        logger.info("updating indices.store.throttle.type from [{}] to [{}]", IndicesStore.this.rateLimitingType, rateLimitingType);
        IndicesStore.this.rateLimitingType = rateLimitingType;
        IndicesStore.this.rateLimiting.setType(rateLimitingType);
    }

    ByteSizeValue rateLimitingThrottle = settings.getAsBytesSize(
            INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC,
            IndicesStore.this.settings.getAsBytesSize(
                    INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC,
                    DEFAULT_INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC));
    if (!rateLimitingThrottle.equals(IndicesStore.this.rateLimitingThrottle)) {
        logger.info("updating indices.store.throttle.max_bytes_per_sec from [{}] to [{}], note, type is [{}]", IndicesStore.this.rateLimitingThrottle, rateLimitingThrottle, IndicesStore.this.rateLimitingType);
        IndicesStore.this.rateLimitingThrottle = rateLimitingThrottle;
        IndicesStore.this.rateLimiting.setMaxRate(rateLimitingThrottle);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:24,代码来源:IndicesStore.java

示例2: IndicesStore

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public IndicesStore(Settings settings, NodeSettingsService nodeSettingsService, IndicesService indicesService,
                    ClusterService clusterService, TransportService transportService) {
    super(settings);
    this.nodeSettingsService = nodeSettingsService;
    this.indicesService = indicesService;
    this.clusterService = clusterService;
    this.transportService = transportService;
    transportService.registerRequestHandler(ACTION_SHARD_EXISTS, ShardActiveRequest.class, ThreadPool.Names.SAME, new ShardActiveRequestHandler());

    // we don't limit by default (we default to CMS's auto throttle instead):
    this.rateLimitingType = settings.get("indices.store.throttle.type", DEFAULT_RATE_LIMITING_TYPE);
    rateLimiting.setType(rateLimitingType);
    this.rateLimitingThrottle = settings.getAsBytesSize("indices.store.throttle.max_bytes_per_sec", DEFAULT_INDICES_STORE_THROTTLE_MAX_BYTES_PER_SEC);
    rateLimiting.setMaxRate(rateLimitingThrottle);

    this.deleteShardTimeout = settings.getAsTime(INDICES_STORE_DELETE_SHARD_TIMEOUT, new TimeValue(30, TimeUnit.SECONDS));

    logger.debug("using indices.store.throttle.type [{}], with index.store.throttle.max_bytes_per_sec [{}]", rateLimitingType, rateLimitingThrottle);

    nodeSettingsService.addListener(applySettings);
    clusterService.addLast(this);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:24,代码来源:IndicesStore.java

示例3: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    String rateLimitingType = settings.get(INDEX_STORE_THROTTLE_TYPE, IndexStore.this.rateLimitingType);
    if (!rateLimitingType.equals(IndexStore.this.rateLimitingType)) {
        logger.info("updating index.store.throttle.type from [{}] to [{}]", IndexStore.this.rateLimitingType, rateLimitingType);
        if (rateLimitingType.equalsIgnoreCase("node")) {
            IndexStore.this.rateLimitingType = rateLimitingType;
            IndexStore.this.nodeRateLimiting = true;
        } else {
            StoreRateLimiting.Type.fromString(rateLimitingType);
            IndexStore.this.rateLimitingType = rateLimitingType;
            IndexStore.this.nodeRateLimiting = false;
            IndexStore.this.rateLimiting.setType(rateLimitingType);
        }
    }

    ByteSizeValue rateLimitingThrottle = settings.getAsBytesSize(INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC, IndexStore.this.rateLimitingThrottle);
    if (!rateLimitingThrottle.equals(IndexStore.this.rateLimitingThrottle)) {
        logger.info("updating index.store.throttle.max_bytes_per_sec from [{}] to [{}], note, type is [{}]", IndexStore.this.rateLimitingThrottle, rateLimitingThrottle, IndexStore.this.rateLimitingType);
        IndexStore.this.rateLimitingThrottle = rateLimitingThrottle;
        IndexStore.this.rateLimiting.setMaxRate(rateLimitingThrottle);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:24,代码来源:IndexStore.java

示例4: IndexStore

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public IndexStore(Index index, IndexSettingsService settingsService, IndicesStore indicesStore) {
    super(index, settingsService.getSettings());
    Settings indexSettings = settingsService.getSettings();
    this.indicesStore = indicesStore;

    this.rateLimitingType = indexSettings.get(INDEX_STORE_THROTTLE_TYPE, "none");
    if (rateLimitingType.equalsIgnoreCase("node")) {
        nodeRateLimiting = true;
    } else {
        nodeRateLimiting = false;
        rateLimiting.setType(rateLimitingType);
    }
    this.rateLimitingThrottle = indexSettings.getAsBytesSize(INDEX_STORE_THROTTLE_MAX_BYTES_PER_SEC, new ByteSizeValue(0));
    rateLimiting.setMaxRate(rateLimitingThrottle);

    logger.debug("using index.store.throttle.type [{}], with index.store.throttle.max_bytes_per_sec [{}]", rateLimitingType, rateLimitingThrottle);
    this.settingsService = settingsService;
    this.settingsService.addListener(applySettings);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:IndexStore.java

示例5: getRateLimiter

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
/**
 * Configures RateLimiter based on repository and global settings
 *
 * @param repositorySettings repository settings
 * @param setting            setting to use to configure rate limiter
 * @param defaultRate        default limiting rate
 * @return rate limiter or null of no throttling is needed
 */
private RateLimiter getRateLimiter(Settings repositorySettings, String setting, ByteSizeValue defaultRate) {
    ByteSizeValue maxSnapshotBytesPerSec = repositorySettings.getAsBytesSize(setting,
            settings.getAsBytesSize(setting, defaultRate));
    if (maxSnapshotBytesPerSec.getBytes() <= 0) {
        return null;
    } else {
        return new RateLimiter.SimpleRateLimiter(maxSnapshotBytesPerSec.getMbFrac());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:BlobStoreRepository.java

示例6: MergePolicyConfig

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public MergePolicyConfig(ESLogger logger, Settings indexSettings) {
    this.logger = logger;
    this.noCFSRatio = parseNoCFSRatio(indexSettings.get(INDEX_COMPOUND_FORMAT, Double.toString(TieredMergePolicy.DEFAULT_NO_CFS_RATIO)));
    double forceMergeDeletesPctAllowed = indexSettings.getAsDouble("index.merge.policy.expunge_deletes_allowed", DEFAULT_EXPUNGE_DELETES_ALLOWED); // percentage
    ByteSizeValue floorSegment = indexSettings.getAsBytesSize("index.merge.policy.floor_segment", DEFAULT_FLOOR_SEGMENT);
    int maxMergeAtOnce = indexSettings.getAsInt("index.merge.policy.max_merge_at_once", DEFAULT_MAX_MERGE_AT_ONCE);
    int maxMergeAtOnceExplicit = indexSettings.getAsInt("index.merge.policy.max_merge_at_once_explicit", DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT);
    // TODO is this really a good default number for max_merge_segment, what happens for large indices, won't they end up with many segments?
    ByteSizeValue maxMergedSegment = indexSettings.getAsBytesSize("index.merge.policy.max_merged_segment", DEFAULT_MAX_MERGED_SEGMENT);
    double segmentsPerTier = indexSettings.getAsDouble("index.merge.policy.segments_per_tier", DEFAULT_SEGMENTS_PER_TIER);
    double reclaimDeletesWeight = indexSettings.getAsDouble("index.merge.policy.reclaim_deletes_weight", DEFAULT_RECLAIM_DELETES_WEIGHT);
    this.mergesEnabled = indexSettings.getAsBoolean(INDEX_MERGE_ENABLED, true);
    if (mergesEnabled == false) {
        logger.warn("[{}] is set to false, this should only be used in tests and can cause serious problems in production environments", INDEX_MERGE_ENABLED);
    }
    maxMergeAtOnce = adjustMaxMergeAtOnceIfNeeded(maxMergeAtOnce, segmentsPerTier);
    mergePolicy.setNoCFSRatio(noCFSRatio);
    mergePolicy.setForceMergeDeletesPctAllowed(forceMergeDeletesPctAllowed);
    mergePolicy.setFloorSegmentMB(floorSegment.mbFrac());
    mergePolicy.setMaxMergeAtOnce(maxMergeAtOnce);
    mergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
    mergePolicy.setMaxMergedSegmentMB(maxMergedSegment.mbFrac());
    mergePolicy.setSegmentsPerTier(segmentsPerTier);
    mergePolicy.setReclaimDeletesWeight(reclaimDeletesWeight);
    logger.debug("using [tiered] merge mergePolicy with expunge_deletes_allowed[{}], floor_segment[{}], max_merge_at_once[{}], max_merge_at_once_explicit[{}], max_merged_segment[{}], segments_per_tier[{}], reclaim_deletes_weight[{}]",
            forceMergeDeletesPctAllowed, floorSegment, maxMergeAtOnce, maxMergeAtOnceExplicit, maxMergedSegment, segmentsPerTier, reclaimDeletesWeight);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:28,代码来源:MergePolicyConfig.java

示例7: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    int flushThresholdOperations = settings.getAsInt(INDEX_TRANSLOG_FLUSH_THRESHOLD_OPS, TranslogService.this.flushThresholdOperations);
    if (flushThresholdOperations != TranslogService.this.flushThresholdOperations) {
        logger.info("updating flush_threshold_ops from [{}] to [{}]", TranslogService.this.flushThresholdOperations, flushThresholdOperations);
        TranslogService.this.flushThresholdOperations = flushThresholdOperations;
    }
    ByteSizeValue flushThresholdSize = settings.getAsBytesSize(INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, TranslogService.this.flushThresholdSize);
    if (!flushThresholdSize.equals(TranslogService.this.flushThresholdSize)) {
        logger.info("updating flush_threshold_size from [{}] to [{}]", TranslogService.this.flushThresholdSize, flushThresholdSize);
        TranslogService.this.flushThresholdSize = flushThresholdSize;
    }
    TimeValue flushThresholdPeriod = settings.getAsTime(INDEX_TRANSLOG_FLUSH_THRESHOLD_PERIOD, TranslogService.this.flushThresholdPeriod);
    if (!flushThresholdPeriod.equals(TranslogService.this.flushThresholdPeriod)) {
        logger.info("updating flush_threshold_period from [{}] to [{}]", TranslogService.this.flushThresholdPeriod, flushThresholdPeriod);
        TranslogService.this.flushThresholdPeriod = flushThresholdPeriod;
    }
    TimeValue interval = settings.getAsTime(INDEX_TRANSLOG_FLUSH_INTERVAL, TranslogService.this.interval);
    if (!interval.equals(TranslogService.this.interval)) {
        logger.info("updating interval from [{}] to [{}]", TranslogService.this.interval, interval);
        TranslogService.this.interval = interval;
    }
    boolean disableFlush = settings.getAsBoolean(INDEX_TRANSLOG_DISABLE_FLUSH, TranslogService.this.disableFlush);
    if (disableFlush != TranslogService.this.disableFlush) {
        logger.info("updating disable_flush from [{}] to [{}]", TranslogService.this.disableFlush, disableFlush);
        TranslogService.this.disableFlush = disableFlush;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:29,代码来源:TranslogService.java

示例8: extractByteSizeValue

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public ByteSizeValue extractByteSizeValue(Settings settings) {
    return settings.getAsBytesSize(settingName(), defaultValue());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:ByteSizeSetting.java

示例9: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    final double oldExpungeDeletesPctAllowed = mergePolicy.getForceMergeDeletesPctAllowed();
    final double expungeDeletesPctAllowed = settings.getAsDouble(INDEX_MERGE_POLICY_EXPUNGE_DELETES_ALLOWED, oldExpungeDeletesPctAllowed);
    if (expungeDeletesPctAllowed != oldExpungeDeletesPctAllowed) {
        logger.info("updating [expunge_deletes_allowed] from [{}] to [{}]", oldExpungeDeletesPctAllowed, expungeDeletesPctAllowed);
        mergePolicy.setForceMergeDeletesPctAllowed(expungeDeletesPctAllowed);
    }

    final double oldFloorSegmentMB = mergePolicy.getFloorSegmentMB();
    final ByteSizeValue floorSegment = settings.getAsBytesSize(INDEX_MERGE_POLICY_FLOOR_SEGMENT, null);
    if (floorSegment != null && floorSegment.mbFrac() != oldFloorSegmentMB) {
        logger.info("updating [floor_segment] from [{}mb] to [{}]", oldFloorSegmentMB, floorSegment);
        mergePolicy.setFloorSegmentMB(floorSegment.mbFrac());
    }

    final double oldSegmentsPerTier = mergePolicy.getSegmentsPerTier();
    final double segmentsPerTier = settings.getAsDouble(INDEX_MERGE_POLICY_SEGMENTS_PER_TIER, oldSegmentsPerTier);
    if (segmentsPerTier != oldSegmentsPerTier) {
        logger.info("updating [segments_per_tier] from [{}] to [{}]", oldSegmentsPerTier, segmentsPerTier);
        mergePolicy.setSegmentsPerTier(segmentsPerTier);
    }

    final int oldMaxMergeAtOnce = mergePolicy.getMaxMergeAtOnce();
    int maxMergeAtOnce = settings.getAsInt(INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE, oldMaxMergeAtOnce);
    if (maxMergeAtOnce != oldMaxMergeAtOnce) {
        logger.info("updating [max_merge_at_once] from [{}] to [{}]", oldMaxMergeAtOnce, maxMergeAtOnce);
        maxMergeAtOnce = adjustMaxMergeAtOnceIfNeeded(maxMergeAtOnce, segmentsPerTier);
        mergePolicy.setMaxMergeAtOnce(maxMergeAtOnce);
    }

    final int oldMaxMergeAtOnceExplicit = mergePolicy.getMaxMergeAtOnceExplicit();
    final int maxMergeAtOnceExplicit = settings.getAsInt(INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT, oldMaxMergeAtOnceExplicit);
    if (maxMergeAtOnceExplicit != oldMaxMergeAtOnceExplicit) {
        logger.info("updating [max_merge_at_once_explicit] from [{}] to [{}]", oldMaxMergeAtOnceExplicit, maxMergeAtOnceExplicit);
        mergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
    }

    final double oldMaxMergedSegmentMB = mergePolicy.getMaxMergedSegmentMB();
    final ByteSizeValue maxMergedSegment = settings.getAsBytesSize(INDEX_MERGE_POLICY_MAX_MERGED_SEGMENT, null);
    if (maxMergedSegment != null && maxMergedSegment.mbFrac() != oldMaxMergedSegmentMB) {
        logger.info("updating [max_merged_segment] from [{}mb] to [{}]", oldMaxMergedSegmentMB, maxMergedSegment);
        mergePolicy.setMaxMergedSegmentMB(maxMergedSegment.mbFrac());
    }

    final double oldReclaimDeletesWeight = mergePolicy.getReclaimDeletesWeight();
    final double reclaimDeletesWeight = settings.getAsDouble(INDEX_MERGE_POLICY_RECLAIM_DELETES_WEIGHT, oldReclaimDeletesWeight);
    if (reclaimDeletesWeight != oldReclaimDeletesWeight) {
        logger.info("updating [reclaim_deletes_weight] from [{}] to [{}]", oldReclaimDeletesWeight, reclaimDeletesWeight);
        mergePolicy.setReclaimDeletesWeight(reclaimDeletesWeight);
    }

    double noCFSRatio = parseNoCFSRatio(settings.get(INDEX_COMPOUND_FORMAT, Double.toString(MergePolicyConfig.this.noCFSRatio)));
    if (noCFSRatio != MergePolicyConfig.this.noCFSRatio) {
        logger.info("updating index.compound_format from [{}] to [{}]", formatNoCFSRatio(MergePolicyConfig.this.noCFSRatio), formatNoCFSRatio(noCFSRatio));
        mergePolicy.setNoCFSRatio(noCFSRatio);
        MergePolicyConfig.this.noCFSRatio = noCFSRatio;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:60,代码来源:MergePolicyConfig.java


注:本文中的org.elasticsearch.common.settings.Settings.getAsBytesSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。