Skip to content

Commit a8fa797

Browse files
Fix logsdb rolling upgrade tests (#135460)
These tests were failing because we renamed the setting index.mapping.patterned_text.disable_templating to index.mapping.pattern_text.disable_templating. The old node would create an index using the old name, then the new node would try to load the index with the old setting and throw an error because the old name was unrecognized. This is not an issue in production because the setting is gated behind a feature flag. This patch adds a node feature representing the rename, then updates the rolling upgrade tests to only run if the rename is present on the old cluster as well.
1 parent 1108f83 commit a8fa797

File tree

9 files changed

+67
-43
lines changed

9 files changed

+67
-43
lines changed

muted-tests.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,6 @@ tests:
588588
- class: org.elasticsearch.search.sort.FieldSortIT
589589
method: testSortMixedFieldTypes
590590
issue: https://github.com/elastic/elasticsearch/issues/129445
591-
- class: org.elasticsearch.upgrades.SyntheticSourceRollingUpgradeIT
592-
method: testIndexing {upgradedNodes=3}
593-
issue: https://github.com/elastic/elasticsearch/issues/135338
594-
- class: org.elasticsearch.upgrades.SyntheticSourceRollingUpgradeIT
595-
method: testIndexing {upgradedNodes=2}
596-
issue: https://github.com/elastic/elasticsearch/issues/135344
597591
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
598592
method: "testEvaluateInManyThreads {TestCase=<double>, <double>, <double>, <_source> #17}"
599593
issue: https://github.com/elastic/elasticsearch/issues/135357
@@ -603,45 +597,12 @@ tests:
603597
- class: org.elasticsearch.xpack.esql.session.SessionUtilsTests
604598
method: testFromPages
605599
issue: https://github.com/elastic/elasticsearch/issues/135377
606-
- class: org.elasticsearch.upgrades.LogsUsageRollingUpgradeIT
607-
method: testUsage {upgradedNodes=3}
608-
issue: https://github.com/elastic/elasticsearch/issues/135312
609-
- class: org.elasticsearch.upgrades.NoLogsUsageRollingUpgradeIT
610-
method: testUsage {upgradedNodes=3}
611-
issue: https://github.com/elastic/elasticsearch/issues/135316
612-
- class: org.elasticsearch.upgrades.NoLogsUsageRollingUpgradeIT
613-
method: testUsage {upgradedNodes=2}
614-
issue: https://github.com/elastic/elasticsearch/issues/135319
615600
- class: org.elasticsearch.xpack.esql.expression.function.scalar.score.DecayTests
616601
method: "testEvaluateBlockWithoutNulls {TestCase=<date_nanos>, <date_nanos>, <time_duration>, <_source> #12}"
617602
issue: https://github.com/elastic/elasticsearch/issues/135394
618-
- class: org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT
619-
method: testIndexing {upgradedNodes=2}
620-
issue: https://github.com/elastic/elasticsearch/issues/135327
621-
- class: org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT
622-
method: testIndexing {upgradedNodes=3}
623-
issue: https://github.com/elastic/elasticsearch/issues/135320
624-
- class: org.elasticsearch.upgrades.StandardToLogsDbIndexModeRollingUpgradeIT
625-
method: testLogsIndexing {upgradedNodes=3}
626-
issue: https://github.com/elastic/elasticsearch/issues/135315
627-
- class: org.elasticsearch.upgrades.StandardToLogsDbIndexModeRollingUpgradeIT
628-
method: testLogsIndexing {upgradedNodes=2}
629-
issue: https://github.com/elastic/elasticsearch/issues/135314
630603
- class: org.elasticsearch.xpack.esql.session.SessionUtilsTests
631604
method: testCheckPagesBelowSize
632605
issue: https://github.com/elastic/elasticsearch/issues/135398
633-
- class: org.elasticsearch.upgrades.TextRollingUpgradeIT
634-
method: testIndexing {upgradedNodes=3}
635-
issue: https://github.com/elastic/elasticsearch/issues/135237
636-
- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT
637-
method: testIndexing {upgradedNodes=3}
638-
issue: https://github.com/elastic/elasticsearch/issues/135324
639-
- class: org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT
640-
method: testIndexing {upgradedNodes=2}
641-
issue: https://github.com/elastic/elasticsearch/issues/135325
642-
- class: org.elasticsearch.upgrades.TextRollingUpgradeIT
643-
method: testIndexing {upgradedNodes=2}
644-
issue: https://github.com/elastic/elasticsearch/issues/135238
645606
- class: org.elasticsearch.upgrades.DataStreamsUpgradeIT
646607
method: testDataStreamValidationDoesNotBreakUpgrade
647608
issue: https://github.com/elastic/elasticsearch/issues/135406
@@ -651,9 +612,6 @@ tests:
651612
- class: org.elasticsearch.upgrades.QueryableBuiltInRolesUpgradeIT
652613
method: testBuiltInRolesSyncedOnClusterUpgrade
653614
issue: https://github.com/elastic/elasticsearch/issues/135194
654-
- class: org.elasticsearch.upgrades.StandardToLogsDbIndexModeRollingUpgradeIT
655-
method: testLogsIndexing {upgradedNodes=1}
656-
issue: https://github.com/elastic/elasticsearch/issues/135313
657615
- class: org.elasticsearch.gradle.TestClustersPluginFuncTest
658616
method: override jdk usage via ES_JAVA_HOME for known jdk os incompatibilities
659617
issue: https://github.com/elastic/elasticsearch/issues/135413

server/src/main/java/org/elasticsearch/index/mapper/MapperFeatures.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class MapperFeatures implements FeatureSpecification {
5151
static final NodeFeature PATTERN_TEXT = new NodeFeature("mapper.patterned_text");
5252
static final NodeFeature IGNORED_SOURCE_FIELDS_PER_ENTRY = new NodeFeature("mapper.ignored_source_fields_per_entry");
5353
public static final NodeFeature MULTI_FIELD_UNICODE_OPTIMISATION_FIX = new NodeFeature("mapper.multi_field.unicode_optimisation_fix");
54+
static final NodeFeature PATTERN_TEXT_RENAME = new NodeFeature("mapper.pattern_text_rename");
5455

5556
@Override
5657
public Set<NodeFeature> getTestFeatures() {
@@ -87,7 +88,8 @@ public Set<NodeFeature> getTestFeatures() {
8788
PATTERN_TEXT,
8889
IGNORED_SOURCE_FIELDS_PER_ENTRY,
8990
MULTI_FIELD_UNICODE_OPTIMISATION_FIX,
90-
MATCH_ONLY_TEXT_BLOCK_LOADER_FIX
91+
MATCH_ONLY_TEXT_BLOCK_LOADER_FIX,
92+
PATTERN_TEXT_RENAME
9193
);
9294
}
9395
}

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsUsageRollingUpgradeIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313

14+
import org.elasticsearch.Build;
1415
import org.elasticsearch.client.Request;
16+
import org.junit.Before;
1517

1618
import java.io.IOException;
1719
import java.time.Instant;
@@ -29,6 +31,13 @@ public LogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
2931
super(upgradedNodes);
3032
}
3133

34+
@Before
35+
public void checkFeatures() {
36+
if (Build.current().isSnapshot()) {
37+
assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename"));
38+
}
39+
}
40+
3241
public void testUsage() throws Exception {
3342
assumeFalse("logsdb.prior_logs_usage only gets set in 8.x", oldClusterHasFeature("gte_v9.0.0"));
3443
String dataStreamName = "logs-mysql-error";

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/LogsdbIndexingRollingUpgradeIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313

14+
import org.elasticsearch.Build;
1415
import org.elasticsearch.client.Request;
1516
import org.elasticsearch.client.Response;
1617
import org.elasticsearch.client.ResponseException;
@@ -20,6 +21,7 @@
2021
import org.elasticsearch.common.xcontent.XContentHelper;
2122
import org.elasticsearch.test.rest.ObjectPath;
2223
import org.elasticsearch.xcontent.XContentType;
24+
import org.junit.Before;
2325

2426
import java.io.IOException;
2527
import java.io.InputStream;
@@ -74,6 +76,13 @@ public LogsdbIndexingRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes)
7476
super(upgradedNodes);
7577
}
7678

79+
@Before
80+
public void checkFeatures() {
81+
if (Build.current().isSnapshot()) {
82+
assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename"));
83+
}
84+
}
85+
7786
public void testIndexing() throws Exception {
7887
String dataStreamName = "logs-bwc-test";
7988
if (isOldCluster()) {

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/MatchOnlyTextRollingUpgradeIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313

14+
import org.elasticsearch.Build;
1415
import org.elasticsearch.client.Request;
1516
import org.elasticsearch.client.Response;
1617
import org.elasticsearch.client.ResponseException;
@@ -21,6 +22,7 @@
2122
import org.elasticsearch.index.mapper.MapperFeatures;
2223
import org.elasticsearch.test.rest.ObjectPath;
2324
import org.elasticsearch.xcontent.XContentType;
25+
import org.junit.Before;
2426

2527
import java.io.IOException;
2628
import java.io.InputStream;
@@ -90,6 +92,13 @@ public MatchOnlyTextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
9092
super(upgradedNodes);
9193
}
9294

95+
@Before
96+
public void checkFeatures() {
97+
if (Build.current().isSnapshot()) {
98+
assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename"));
99+
}
100+
}
101+
93102
public void testIndexing() throws Exception {
94103
assumeTrue(
95104
"Match only text block loader fix is not present in this cluster",

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/NoLogsUsageRollingUpgradeIT.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313

14+
import org.elasticsearch.Build;
15+
import org.junit.Before;
16+
1417
import java.time.Instant;
1518
import java.util.Map;
1619

@@ -26,6 +29,13 @@ public NoLogsUsageRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
2629
super(upgradedNodes);
2730
}
2831

32+
@Before
33+
public void checkFeatures() {
34+
if (Build.current().isSnapshot()) {
35+
assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename"));
36+
}
37+
}
38+
2939
public void testUsage() throws Exception {
3040
String dataStreamName = "logs-mysql-error";
3141
if (isOldCluster()) {

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/StandardToLogsDbIndexModeRollingUpgradeIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313

14+
import org.elasticsearch.Build;
1415
import org.elasticsearch.client.Request;
1516
import org.elasticsearch.client.Response;
1617
import org.elasticsearch.client.RestClient;
@@ -24,6 +25,7 @@
2425
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
2526
import org.hamcrest.Matcher;
2627
import org.hamcrest.Matchers;
28+
import org.junit.Before;
2729
import org.junit.ClassRule;
2830

2931
import java.io.IOException;
@@ -114,6 +116,13 @@ protected Settings restClientSettings() {
114116
}
115117
}""";
116118

119+
@Before
120+
public void checkFeatures() {
121+
if (Build.current().isSnapshot()) {
122+
assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename"));
123+
}
124+
}
125+
117126
public void testLogsIndexing() throws IOException {
118127
if (isOldCluster()) {
119128
// given - create a template and data stream

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/SyntheticSourceRollingUpgradeIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111

1212
import com.carrotsearch.randomizedtesting.annotations.Name;
1313

14+
import org.elasticsearch.Build;
1415
import org.elasticsearch.client.Request;
1516
import org.elasticsearch.test.rest.ObjectPath;
1617
import org.hamcrest.Matchers;
18+
import org.junit.Before;
1719

1820
import java.time.Instant;
1921
import java.util.Arrays;
@@ -70,6 +72,13 @@ public SyntheticSourceRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes)
7072
super(upgradedNodes);
7173
}
7274

75+
@Before
76+
public void checkFeatures() {
77+
if (Build.current().isSnapshot()) {
78+
assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename"));
79+
}
80+
}
81+
7382
public void testIndexing() throws Exception {
7483
assumeTrue("requires storing leaf array offsets", oldClusterHasFeature("gte_v9.1.0"));
7584
String dataStreamName = "logs-bwc-test";

x-pack/plugin/logsdb/qa/rolling-upgrade/src/javaRestTest/java/org/elasticsearch/upgrades/TextRollingUpgradeIT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import com.carrotsearch.randomizedtesting.annotations.Name;
1111

12+
import org.elasticsearch.Build;
1213
import org.elasticsearch.client.Request;
1314
import org.elasticsearch.client.Response;
1415
import org.elasticsearch.client.ResponseException;
@@ -18,6 +19,7 @@
1819
import org.elasticsearch.common.xcontent.XContentHelper;
1920
import org.elasticsearch.test.rest.ObjectPath;
2021
import org.elasticsearch.xcontent.XContentType;
22+
import org.junit.Before;
2123

2224
import java.io.IOException;
2325
import java.io.InputStream;
@@ -87,6 +89,13 @@ public TextRollingUpgradeIT(@Name("upgradedNodes") int upgradedNodes) {
8789
super(upgradedNodes);
8890
}
8991

92+
@Before
93+
public void checkFeatures() {
94+
if (Build.current().isSnapshot()) {
95+
assumeTrue("rename of pattern_text mapper", oldClusterHasFeature("mapper.pattern_text_rename"));
96+
}
97+
}
98+
9099
public void testIndexing() throws Exception {
91100

92101
if (isOldCluster()) {

0 commit comments

Comments
 (0)