Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Herman <[email protected]>
  • Loading branch information
sam-herman committed May 1, 2024
1 parent 51fa0eb commit d651617
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased 2.x]
### Added
- Add useCompoundFile index setting ([#13478](https://github.com/opensearch-project/OpenSearch/pull/13478))
- Constant Keyword Field ([#12285](https://github.com/opensearch-project/OpenSearch/pull/12285))
- Convert ingest processor supports ip type ([#12818](https://github.com/opensearch-project/OpenSearch/pull/12818))
- Add a counter to node stat api to track shard going from idle to non-idle ([#12768](https://github.com/opensearch-project/OpenSearch/pull/12768))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
}
}, Property.IndexScope, Property.NodeScope);



/**
* Index setting to change the compression level of zstd and zstd_no_dict lucene codecs.
* Compression Level gives a trade-off between compression ratio and speed. The higher compression level results in higher compression ratio but slower compression and decompression speeds.
Expand Down Expand Up @@ -241,8 +239,7 @@ private static void doValidateCodecSettings(final String codec) {
public static final Setting<Boolean> INDEX_USE_COMPOUND_FILE = Setting.boolSetting(
"index.use_compound_file",
true,
Property.IndexScope,
Property.Dynamic
Property.IndexScope
);

private final TranslogConfig translogConfig;
Expand Down Expand Up @@ -503,7 +500,7 @@ public boolean isReadOnlyReplica() {
return indexSettings.isSegRepEnabledOrRemoteNode() && isReadOnlyReplica;
}

public boolean isUseCompoundFile() {
public boolean useCompoundFile() {
return indexSettings.getValue(INDEX_USE_COMPOUND_FILE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,7 @@ private IndexWriterConfig getIndexWriterConfig() {
iwc.setSimilarity(engineConfig.getSimilarity());
iwc.setRAMBufferSizeMB(engineConfig.getIndexingBufferSize().getMbFrac());
iwc.setCodec(engineConfig.getCodec());
iwc.setUseCompoundFile(engineConfig.isUseCompoundFile());
iwc.setUseCompoundFile(engineConfig.useCompoundFile());
if (config().getIndexSort() != null) {
iwc.setIndexSort(config().getIndexSort());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void testEngineConfig_DefaultValueFoUseCompoundFile() {
EngineConfig config = new EngineConfig.Builder().indexSettings(defaultIndexSettings)
.retentionLeasesSupplier(() -> RetentionLeases.EMPTY)
.build();
assertTrue(config.isUseCompoundFile());
assertTrue(config.useCompoundFile());
}

public void testEngineConfig_DefaultValueForReadOnlyEngine() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public void testSegmentsWithUseCompoundFileFlag_true() throws IOException {
engine.index(index);
engine.flush();
final List<Segment> segments = engine.segments(false);
assertThat(segments.size(), equalTo(1));
assertThat(segments, hasSize(1));
assertTrue(segments.get(0).compound);
boolean cfeCompoundFileFound = false;
boolean cfsCompoundFileFound = false;
Expand All @@ -369,18 +369,15 @@ public void testSegmentsWithUseCompoundFileFlag_true() throws IOException {
public void testSegmentsWithUseCompoundFileFlag_false() throws IOException {
final IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(
"test",
Settings.builder()
.put(defaultSettings.getSettings())
.put(EngineConfig.INDEX_USE_COMPOUND_FILE.getKey(), false)
.build()
Settings.builder().put(defaultSettings.getSettings()).put(EngineConfig.INDEX_USE_COMPOUND_FILE.getKey(), false).build()
);
try (Store store = createStore(); Engine engine = createEngine(indexSettings, store, createTempDir(), new TieredMergePolicy())) {
ParsedDocument doc = testParsedDocument("1", null, testDocument(), B_1, null);
Engine.Index index = indexForDoc(doc);
engine.index(index);
engine.flush();
final List<Segment> segments = engine.segments(false);
assertThat(segments.size(), equalTo(1));
assertThat(segments, hasSize(1));
assertFalse(segments.get(0).compound);
boolean cfeCompoundFileFound = false;
boolean cfsCompoundFileFound = false;
Expand Down

0 comments on commit d651617

Please sign in to comment.