Skip to content

Commit 47a31ce

Browse files
Merge branch 'main' into fix-test-mtermvectors
2 parents 2343745 + c288684 commit 47a31ce

File tree

36 files changed

+373
-924
lines changed

36 files changed

+373
-924
lines changed

docs/internal/Versioning.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ Every change to the transport protocol is represented by a new transport version
3535
higher than all previous transport versions, which then becomes the highest version
3636
recognized by that build of Elasticsearch. The version ids are stored
3737
as constants in the `TransportVersions` class.
38-
Each id has a standard pattern `M_NNN_SS_P`, where:
38+
Each id has a standard pattern `M_NNN_S_PP`, where:
3939
* `M` is the major version
4040
* `NNN` is an incrementing id
41-
* `SS` is used in subsidiary repos amending the default transport protocol
42-
* `P` is used for patches and backports
41+
* `S` is used in subsidiary repos amending the default transport protocol
42+
* `PP` is used for patches and backports
4343

4444
When you make a change to the serialization form of any object,
4545
you need to create a new sequential constant in `TransportVersions`,
4646
introduced in the same PR that adds the change, that increments
4747
the `NNN` component from the previous highest version,
4848
with other components set to zero.
49-
For example, if the previous version number is `8_413_00_1`,
50-
the next version number should be `8_414_00_0`.
49+
For example, if the previous version number is `8_413_0_01`,
50+
the next version number should be `8_414_0_00`.
5151

5252
Once you have defined your constant, you then need to use it
5353
in serialization code. If the transport version is at or above the new id,
@@ -166,7 +166,7 @@ also has that change, and knows about the patch backport ids and what they mean.
166166

167167
Index version is a single incrementing version number for the index data format,
168168
metadata, and associated mappings. It is declared the same way as the
169-
transport version - with the pattern `M_NNN_SS_P`, for the major version, version id,
169+
transport version - with the pattern `M_NNN_S_PP`, for the major version, version id,
170170
subsidiary version id, and patch number respectively.
171171

172172
Index version is stored in index metadata when an index is created,

muted-tests.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,6 @@ tests:
329329
- class: org.elasticsearch.upgrades.VectorSearchIT
330330
method: testBBQVectorSearch {upgradedNodes=0}
331331
issue: https://github.com/elastic/elasticsearch/issues/121253
332-
- class: org.elasticsearch.lucene.FullClusterRestartLuceneIndexCompatibilityIT
333-
issue: https://github.com/elastic/elasticsearch/issues/121257
334332
- class: org.elasticsearch.upgrades.VectorSearchIT
335333
method: testBBQVectorSearch {upgradedNodes=1}
336334
issue: https://github.com/elastic/elasticsearch/issues/121271
@@ -386,8 +384,6 @@ tests:
386384
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
387385
method: testDependentVariableIsAliasToNested
388386
issue: https://github.com/elastic/elasticsearch/issues/121415
389-
- class: org.elasticsearch.datastreams.TSDBPassthroughIndexingIT
390-
issue: https://github.com/elastic/elasticsearch/issues/121464
391387
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
392388
method: testLookupExplosionBigStringManyMatches
393389
issue: https://github.com/elastic/elasticsearch/issues/121465
@@ -447,6 +443,9 @@ tests:
447443
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
448444
method: testDependentVariableIsAliasToKeyword
449445
issue: https://github.com/elastic/elasticsearch/issues/121492
446+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
447+
method: test {yaml=cat.aliases/10_basic/Complex alias}
448+
issue: https://github.com/elastic/elasticsearch/issues/121513
450449

451450
# Examples:
452451
#

qa/lucene-index-compatibility/src/javaRestTest/java/org/elasticsearch/lucene/FullClusterRestartLuceneIndexCompatibilityIT.java

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

1212
import org.elasticsearch.cluster.metadata.IndexMetadata;
1313
import org.elasticsearch.common.settings.Settings;
14-
import org.elasticsearch.index.IndexSettings;
15-
import org.elasticsearch.index.translog.Translog;
1614
import org.elasticsearch.repositories.fs.FsRepository;
1715
import org.elasticsearch.test.cluster.util.Version;
1816

@@ -184,7 +182,6 @@ public void testClosedIndexUpgrade() throws Exception {
184182
Settings.builder()
185183
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
186184
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, randomInt(2))
187-
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), randomFrom(Translog.Durability.values()))
188185
.build()
189186
);
190187
indexDocs(index, numDocs);

qa/lucene-index-compatibility/src/javaRestTest/java/org/elasticsearch/lucene/RollingUpgradeLuceneIndexCompatibilityTestCase.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
import org.elasticsearch.client.ResponseException;
1414
import org.elasticsearch.cluster.metadata.IndexMetadata;
1515
import org.elasticsearch.common.settings.Settings;
16-
import org.elasticsearch.index.IndexSettings;
17-
import org.elasticsearch.index.translog.Translog;
1816
import org.elasticsearch.repositories.fs.FsRepository;
1917
import org.elasticsearch.test.cluster.util.Version;
2018

@@ -189,11 +187,7 @@ public void testClosedIndexUpgrade() throws Exception {
189187
createIndex(
190188
client(),
191189
index,
192-
Settings.builder()
193-
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
194-
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
195-
.put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), randomFrom(Translog.Durability.values()))
196-
.build()
190+
Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).build()
197191
);
198192
indexDocs(index, numDocs);
199193
return;

server/src/main/java/org/elasticsearch/ReleaseVersions.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ public static IntFunction<String> generateVersionsLookup(Class<?> versionContain
7878
// replace all version lists with the smallest & greatest versions
7979
versions.replaceAll((k, v) -> {
8080
if (v.size() == 1) {
81-
return List.of(v.get(0));
81+
return List.of(v.getFirst());
8282
} else {
8383
v.sort(Comparator.naturalOrder());
84-
return List.of(v.get(0), v.get(v.size() - 1));
84+
return List.of(v.getFirst(), v.getLast());
8585
}
8686
});
8787

@@ -100,14 +100,14 @@ private static IntFunction<String> lookupFunction(NavigableMap<Integer, List<Ver
100100

101101
String lowerBound, upperBound;
102102
if (versionRange != null) {
103-
lowerBound = versionRange.get(0).toString();
104-
upperBound = lastItem(versionRange).toString();
103+
lowerBound = versionRange.getFirst().toString();
104+
upperBound = versionRange.getLast().toString();
105105
} else {
106106
// infer the bounds from the surrounding entries
107107
var lowerRange = versions.lowerEntry(id);
108108
if (lowerRange != null) {
109109
// the next version is just a guess - might be a newer revision, might be a newer minor or major...
110-
lowerBound = nextVersion(lastItem(lowerRange.getValue())).toString();
110+
lowerBound = nextVersion(lowerRange.getValue().getLast()).toString();
111111
} else {
112112
// a really old version we don't have a record for
113113
// assume it's an old version id - we can just return it directly
@@ -122,7 +122,7 @@ private static IntFunction<String> lookupFunction(NavigableMap<Integer, List<Ver
122122
var upperRange = versions.higherEntry(id);
123123
if (upperRange != null) {
124124
// too hard to guess what version this id might be for using the next version - just use it directly
125-
upperBound = upperRange.getValue().get(0).toString();
125+
upperBound = upperRange.getValue().getFirst().toString();
126126
} else {
127127
// a newer version than all we know about? Can't map it...
128128
upperBound = "[" + id + "]";
@@ -133,10 +133,6 @@ private static IntFunction<String> lookupFunction(NavigableMap<Integer, List<Ver
133133
};
134134
}
135135

136-
private static <T> T lastItem(List<T> list) {
137-
return list.get(list.size() - 1);
138-
}
139-
140136
private static Version nextVersion(Version version) {
141137
return new Version(version.id + 100); // +1 to revision
142138
}

server/src/main/java/org/elasticsearch/TransportVersion.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,20 @@ public static TransportVersion fromString(String str) {
130130
* When a patch version of an existing transport version is created, {@code transportVersion.isPatchFrom(patchVersion)}
131131
* will match any transport version at or above {@code patchVersion} that is also of the same base version.
132132
* <p>
133-
* For example, {@code version.isPatchFrom(8_800_00_4)} will return the following for the given {@code version}:
133+
* For example, {@code version.isPatchFrom(8_800_0_04)} will return the following for the given {@code version}:
134134
* <ul>
135-
* <li>{@code 8_799_00_0.isPatchFrom(8_800_00_4)}: {@code false}</li>
136-
* <li>{@code 8_799_00_9.isPatchFrom(8_800_00_4)}: {@code false}</li>
137-
* <li>{@code 8_800_00_0.isPatchFrom(8_800_00_4)}: {@code false}</li>
138-
* <li>{@code 8_800_00_3.isPatchFrom(8_800_00_4)}: {@code false}</li>
139-
* <li>{@code 8_800_00_4.isPatchFrom(8_800_00_4)}: {@code true}</li>
140-
* <li>{@code 8_800_00_9.isPatchFrom(8_800_00_4)}: {@code true}</li>
141-
* <li>{@code 8_800_01_0.isPatchFrom(8_800_00_4)}: {@code false}</li>
142-
* <li>{@code 8_801_00_0.isPatchFrom(8_800_00_4)}: {@code false}</li>
135+
* <li>{@code 8_799_0_00.isPatchFrom(8_800_0_04)}: {@code false}</li>
136+
* <li>{@code 8_799_0_09.isPatchFrom(8_800_0_04)}: {@code false}</li>
137+
* <li>{@code 8_800_0_00.isPatchFrom(8_800_0_04)}: {@code false}</li>
138+
* <li>{@code 8_800_0_03.isPatchFrom(8_800_0_04)}: {@code false}</li>
139+
* <li>{@code 8_800_0_04.isPatchFrom(8_800_0_04)}: {@code true}</li>
140+
* <li>{@code 8_800_0_49.isPatchFrom(8_800_0_04)}: {@code true}</li>
141+
* <li>{@code 8_800_1_00.isPatchFrom(8_800_0_04)}: {@code false}</li>
142+
* <li>{@code 8_801_0_00.isPatchFrom(8_800_0_04)}: {@code false}</li>
143143
* </ul>
144144
*/
145145
public boolean isPatchFrom(TransportVersion version) {
146-
return onOrAfter(version) && id < version.id + 10 - (version.id % 10);
146+
return onOrAfter(version) && id < version.id + 100 - (version.id % 100);
147147
}
148148

149149
/**

0 commit comments

Comments
 (0)