@Inject public LogByteSizeMergePolicyProvider(Store store, IndexSettingsService indexSettingsService) { super(store.shardId(), store.indexSettings()); Preconditions.checkNotNull(store, "Store must be provided to merge policy"); this.indexSettingsService = indexSettingsService; this.compoundFormat = indexSettings.getAsBoolean("index.compound_format", store.suggestUseCompoundFile()); this.minMergeSize = componentSettings.getAsBytesSize( "min_merge_size", new ByteSizeValue( (long) (LogByteSizeMergePolicy.DEFAULT_MIN_MERGE_MB * 1024 * 1024), ByteSizeUnit.BYTES)); this.maxMergeSize = componentSettings.getAsBytesSize( "max_merge_size", new ByteSizeValue((long) LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_MB, ByteSizeUnit.MB)); this.mergeFactor = componentSettings.getAsInt("merge_factor", LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR); this.maxMergeDocs = componentSettings.getAsInt("max_merge_docs", LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS); this.calibrateSizeByDeletes = componentSettings.getAsBoolean("calibrate_size_by_deletes", true); this.asyncMerge = indexSettings.getAsBoolean("index.merge.async", true); logger.debug( "using [log_bytes_size] merge policy with merge_factor[{}], min_merge_size[{}], max_merge_size[{}], max_merge_docs[{}], calibrate_size_by_deletes[{}], async_merge[{}]", mergeFactor, minMergeSize, maxMergeSize, maxMergeDocs, calibrateSizeByDeletes, asyncMerge); indexSettingsService.addListener(applySettings); }
@Inject public TieredMergePolicyProvider(Store store, IndexSettingsService indexSettingsService) { super(store.shardId(), store.indexSettings()); this.indexSettingsService = indexSettingsService; this.compoundFormat = indexSettings.getAsBoolean("index.compound_format", store.suggestUseCompoundFile()); this.asyncMerge = indexSettings.getAsBoolean("index.merge.async", true); this.forceMergeDeletesPctAllowed = componentSettings.getAsDouble("expunge_deletes_allowed", 10d); // percentage this.floorSegment = componentSettings.getAsBytesSize("floor_segment", new ByteSizeValue(2, ByteSizeUnit.MB)); this.maxMergeAtOnce = componentSettings.getAsInt("max_merge_at_once", 10); this.maxMergeAtOnceExplicit = componentSettings.getAsInt("max_merge_at_once_explicit", 30); // 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? this.maxMergedSegment = componentSettings.getAsBytesSize( "max_merged_segment", componentSettings.getAsBytesSize( "max_merge_segment", new ByteSizeValue(5, ByteSizeUnit.GB))); this.segmentsPerTier = componentSettings.getAsDouble("segments_per_tier", 10.0d); this.reclaimDeletesWeight = componentSettings.getAsDouble("reclaim_deletes_weight", 2.0d); fixSettingsIfNeeded(); logger.debug( "using [tiered] merge policy with expunge_deletes_allowed[{}], floor_segment[{}], max_merge_at_once[{}], max_merge_at_once_explicit[{}], max_merged_segment[{}], segments_per_tier[{}], reclaim_deletes_weight[{}], async_merge[{}]", forceMergeDeletesPctAllowed, floorSegment, maxMergeAtOnce, maxMergeAtOnceExplicit, maxMergedSegment, segmentsPerTier, reclaimDeletesWeight, asyncMerge); indexSettingsService.addListener(applySettings); }