Skip to content

Commit 8b4db30

Browse files
committed
Unmute TSDBDocValuesFormatSingleNodeTests
The issue was with ZSTD_STORED_FIELDS_FEATURE_FLAG feature flag in release build. The test didn't expect this. Adjusted the test to also take LegacyPerFieldMapperCodec into account. We should lookinto removeing the ZSTD_STORED_FIELDS_FEATURE_FLAG given that we are not actively looking into using zstd compression for default codec case. Closes elastic#143197 Closes elastic#143198
1 parent 34df28f commit 8b4db30

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,6 @@ tests:
449449
- class: org.elasticsearch.index.mapper.ShortFieldMapperTests
450450
method: testSyntheticSourceWithTranslogSnapshot
451451
issue: https://github.com/elastic/elasticsearch/issues/143196
452-
- class: org.elasticsearch.index.codec.tsdb.es819.TSDBDocValuesFormatSingleNodeTests
453-
method: testStandardIndexWithTSDBDocValuesFormatSetting
454-
issue: https://github.com/elastic/elasticsearch/issues/143197
455-
- class: org.elasticsearch.index.codec.tsdb.es819.TSDBDocValuesFormatSingleNodeTests
456-
method: testTSDBIndexUsesCorrectDocValuesFormat
457-
issue: https://github.com/elastic/elasticsearch/issues/143198
458452
- class: org.elasticsearch.snapshots.SnapshotStressTestsIT
459453
method: testRandomActivities
460454
issue: https://github.com/elastic/elasticsearch/issues/143199

server/src/test/java/org/elasticsearch/index/codec/tsdb/es819/TSDBDocValuesFormatSingleNodeTests.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@
1616
import org.elasticsearch.cluster.metadata.IndexMetadata;
1717
import org.elasticsearch.common.settings.Settings;
1818
import org.elasticsearch.index.IndexSettings;
19+
import org.elasticsearch.index.codec.CodecService;
1920
import org.elasticsearch.index.codec.Elasticsearch92Lucene103Codec;
21+
import org.elasticsearch.index.codec.LegacyPerFieldMapperCodec;
2022
import org.elasticsearch.index.engine.Engine;
2123
import org.elasticsearch.indices.IndicesService;
2224
import org.elasticsearch.test.ESSingleNodeTestCase;
2325
import org.elasticsearch.xcontent.XContentFactory;
2426

2527
import java.util.Set;
28+
import java.util.function.Function;
2629

2730
import static org.hamcrest.Matchers.equalTo;
2831
import static org.hamcrest.Matchers.greaterThan;
@@ -86,9 +89,23 @@ private void indexDocuments(String indexName) throws Exception {
8689
private void assertDocValuesFormat(String indexName, DocValuesFormat expectedFormat, Set<String> expectedFields) {
8790
var indexService = getInstanceFromNode(IndicesService.class).indexServiceSafe(resolveIndex(indexName));
8891
var shard = indexService.getShard(0);
89-
var codec = (Elasticsearch92Lucene103Codec) shard.getEngineOrNull().config().getCodec();
92+
var codec = shard.withEngineOrNull(engine -> engine.config().getCodec());
93+
Function<String, DocValuesFormat> docValuesFormatProvider;
94+
if (codec instanceof Elasticsearch92Lucene103Codec es92103codec) {
95+
docValuesFormatProvider = es92103codec::getDocValuesFormatForField;
96+
} else if (codec instanceof CodecService.DeduplicateFieldInfosCodec deduplicateFieldInfosCodec) {
97+
if (deduplicateFieldInfosCodec.delegate() instanceof LegacyPerFieldMapperCodec legacyPerFieldMapperCodec) {
98+
docValuesFormatProvider = legacyPerFieldMapperCodec::getDocValuesFormatForField;
99+
} else {
100+
fail("Unexpected codec type: " + codec.getClass().getName());
101+
return;
102+
}
103+
} else {
104+
fail("Unexpected codec type: " + codec.getClass().getName());
105+
return;
106+
}
90107
for (String field : expectedFields) {
91-
DocValuesFormat writerFormat = codec.getDocValuesFormatForField(field);
108+
DocValuesFormat writerFormat = docValuesFormatProvider.apply(field);
92109
assertThat(
93110
"IndexWriter codec for field [" + field + "] should return the expected TSDB doc values format instance",
94111
writerFormat,

0 commit comments

Comments
 (0)