Skip to content

Commit 40360aa

Browse files
committed
review feedback
Signed-off-by: Samuel Herman <[email protected]>
1 parent b893669 commit 40360aa

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55

66
## [Unreleased 2.x]
77
### Added
8+
- Add useCompoundFile index setting ([#13478](https://github.com/opensearch-project/OpenSearch/pull/13478))
89
- Constant Keyword Field ([#12285](https://github.com/opensearch-project/OpenSearch/pull/12285))
910
- Convert ingest processor supports ip type ([#12818](https://github.com/opensearch-project/OpenSearch/pull/12818))
1011
- 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))

server/src/main/java/org/opensearch/index/engine/EngineConfig.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@ public Supplier<RetentionLeases> retentionLeasesSupplier() {
159159
}
160160
}, Property.IndexScope, Property.NodeScope);
161161

162-
163-
164162
/**
165163
* Index setting to change the compression level of zstd and zstd_no_dict lucene codecs.
166164
* 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.
@@ -241,8 +239,7 @@ private static void doValidateCodecSettings(final String codec) {
241239
public static final Setting<Boolean> INDEX_USE_COMPOUND_FILE = Setting.boolSetting(
242240
"index.use_compound_file",
243241
true,
244-
Property.IndexScope,
245-
Property.Dynamic
242+
Property.IndexScope
246243
);
247244

248245
private final TranslogConfig translogConfig;
@@ -503,7 +500,7 @@ public boolean isReadOnlyReplica() {
503500
return indexSettings.isSegRepEnabledOrRemoteNode() && isReadOnlyReplica;
504501
}
505502

506-
public boolean isUseCompoundFile() {
503+
public boolean useCompoundFile() {
507504
return indexSettings.getValue(INDEX_USE_COMPOUND_FILE);
508505
}
509506

server/src/main/java/org/opensearch/index/engine/InternalEngine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ private IndexWriterConfig getIndexWriterConfig() {
23412341
iwc.setSimilarity(engineConfig.getSimilarity());
23422342
iwc.setRAMBufferSizeMB(engineConfig.getIndexingBufferSize().getMbFrac());
23432343
iwc.setCodec(engineConfig.getCodec());
2344-
iwc.setUseCompoundFile(engineConfig.isUseCompoundFile());
2344+
iwc.setUseCompoundFile(engineConfig.useCompoundFile());
23452345
if (config().getIndexSort() != null) {
23462346
iwc.setIndexSort(config().getIndexSort());
23472347
}

server/src/test/java/org/opensearch/index/engine/EngineConfigTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void testEngineConfig_DefaultValueFoUseCompoundFile() {
3636
EngineConfig config = new EngineConfig.Builder().indexSettings(defaultIndexSettings)
3737
.retentionLeasesSupplier(() -> RetentionLeases.EMPTY)
3838
.build();
39-
assertTrue(config.isUseCompoundFile());
39+
assertTrue(config.useCompoundFile());
4040
}
4141

4242
public void testEngineConfig_DefaultValueForReadOnlyEngine() {

server/src/test/java/org/opensearch/index/engine/InternalEngineTests.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public void testSegmentsWithUseCompoundFileFlag_true() throws IOException {
349349
engine.index(index);
350350
engine.flush();
351351
final List<Segment> segments = engine.segments(false);
352-
assertThat(segments.size(), equalTo(1));
352+
assertThat(segments, hasSize(1));
353353
assertTrue(segments.get(0).compound);
354354
boolean cfeCompoundFileFound = false;
355355
boolean cfsCompoundFileFound = false;
@@ -369,18 +369,15 @@ public void testSegmentsWithUseCompoundFileFlag_true() throws IOException {
369369
public void testSegmentsWithUseCompoundFileFlag_false() throws IOException {
370370
final IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(
371371
"test",
372-
Settings.builder()
373-
.put(defaultSettings.getSettings())
374-
.put(EngineConfig.INDEX_USE_COMPOUND_FILE.getKey(), false)
375-
.build()
372+
Settings.builder().put(defaultSettings.getSettings()).put(EngineConfig.INDEX_USE_COMPOUND_FILE.getKey(), false).build()
376373
);
377374
try (Store store = createStore(); Engine engine = createEngine(indexSettings, store, createTempDir(), new TieredMergePolicy())) {
378375
ParsedDocument doc = testParsedDocument("1", null, testDocument(), B_1, null);
379376
Engine.Index index = indexForDoc(doc);
380377
engine.index(index);
381378
engine.flush();
382379
final List<Segment> segments = engine.segments(false);
383-
assertThat(segments.size(), equalTo(1));
380+
assertThat(segments, hasSize(1));
384381
assertFalse(segments.get(0).compound);
385382
boolean cfeCompoundFileFound = false;
386383
boolean cfsCompoundFileFound = false;

0 commit comments

Comments
 (0)