add calibrateSizeByDeletes option in merge policies

This commit is contained in:
kimchy 2010-02-24 20:45:15 +02:00
parent eb3f8b2f79
commit bcc52a0173
2 changed files with 10 additions and 4 deletions

View File

@ -39,6 +39,7 @@ public class LogByteSizeMergePolicyProvider extends AbstractIndexShardComponent
private final SizeValue maxMergeSize;
private final int mergeFactor;
private final int maxMergeDocs;
private final boolean calibrateSizeByDeletes;
private final Boolean useCompoundFile;
@Inject public LogByteSizeMergePolicyProvider(Store store) {
@ -49,9 +50,10 @@ public class LogByteSizeMergePolicyProvider extends AbstractIndexShardComponent
this.maxMergeSize = componentSettings.getAsSize("maxMergeSize", new SizeValue((long) LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_MB, SizeUnit.MB));
this.mergeFactor = componentSettings.getAsInt("mergeFactor", LogByteSizeMergePolicy.DEFAULT_MERGE_FACTOR);
this.maxMergeDocs = componentSettings.getAsInt("maxMergeDocs", LogByteSizeMergePolicy.DEFAULT_MAX_MERGE_DOCS);
this.calibrateSizeByDeletes = componentSettings.getAsBoolean("calibrateSizeByDeletes", false);
this.useCompoundFile = componentSettings.getAsBoolean("useCompoundFile", store == null || store.suggestUseCompoundFile());
logger.debug("Using [LogByteSize] merge policy with mergeFactor[{}], minMergeSize[{}], maxMergeSize[{}], maxMergeDocs[{}] useCompoundFile[{}]",
new Object[]{mergeFactor, minMergeSize, maxMergeSize, maxMergeDocs, useCompoundFile});
logger.debug("Using [LogByteSize] merge policy with mergeFactor[{}], minMergeSize[{}], maxMergeSize[{}], maxMergeDocs[{}] useCompoundFile[{}], calibrateSizeByDeletes[{}]",
new Object[]{mergeFactor, minMergeSize, maxMergeSize, maxMergeDocs, useCompoundFile, calibrateSizeByDeletes});
}
@Override public LogByteSizeMergePolicy newMergePolicy(IndexWriter indexWriter) {
@ -62,6 +64,7 @@ public class LogByteSizeMergePolicyProvider extends AbstractIndexShardComponent
mergePolicy.setMaxMergeDocs(maxMergeDocs);
mergePolicy.setUseCompoundFile(useCompoundFile);
mergePolicy.setUseCompoundDocStore(useCompoundFile);
mergePolicy.setCalibrateSizeByDeletes(calibrateSizeByDeletes);
return mergePolicy;
}
}

View File

@ -36,6 +36,7 @@ public class LogDocMergePolicyProvider extends AbstractIndexShardComponent imple
private final int minMergeDocs;
private final int maxMergeDocs;
private final int mergeFactor;
private final boolean calibrateSizeByDeletes;
private final Boolean useCompoundFile;
@Inject public LogDocMergePolicyProvider(Store store) {
@ -45,9 +46,10 @@ public class LogDocMergePolicyProvider extends AbstractIndexShardComponent imple
this.minMergeDocs = componentSettings.getAsInt("minMergeDocs", LogDocMergePolicy.DEFAULT_MIN_MERGE_DOCS);
this.maxMergeDocs = componentSettings.getAsInt("maxMergeDocs", LogDocMergePolicy.DEFAULT_MAX_MERGE_DOCS);
this.mergeFactor = componentSettings.getAsInt("mergeFactor", LogDocMergePolicy.DEFAULT_MERGE_FACTOR);
this.calibrateSizeByDeletes = componentSettings.getAsBoolean("calibrateSizeByDeletes", false);
this.useCompoundFile = componentSettings.getAsBoolean("useCompoundFile", store == null || store.suggestUseCompoundFile());
logger.debug("Using [LogDoc] merge policy with mergeFactor[{}] minMergeDocs[{}], maxMergeDocs[{}], useCompoundFile[{}]",
new Object[]{mergeFactor, minMergeDocs, maxMergeDocs, useCompoundFile});
logger.debug("Using [LogDoc] merge policy with mergeFactor[{}] minMergeDocs[{}], maxMergeDocs[{}], useCompoundFile[{}], calibrateSizeByDeletes[{}]",
new Object[]{mergeFactor, minMergeDocs, maxMergeDocs, useCompoundFile, calibrateSizeByDeletes});
}
@Override public LogDocMergePolicy newMergePolicy(IndexWriter indexWriter) {
@ -57,6 +59,7 @@ public class LogDocMergePolicyProvider extends AbstractIndexShardComponent imple
mergePolicy.setMergeFactor(mergeFactor);
mergePolicy.setUseCompoundFile(useCompoundFile);
mergePolicy.setUseCompoundDocStore(useCompoundFile);
mergePolicy.setCalibrateSizeByDeletes(calibrateSizeByDeletes);
return mergePolicy;
}
}