Skip to content

Commit fc98a0e

Browse files
authored
Merge branch 'main' into skip-un-execution
2 parents 8ef56eb + 623a6af commit fc98a0e

File tree

100 files changed

+1738
-1036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+1738
-1036
lines changed

docs/changelog/120957.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 120957
2+
summary: Introduce `AllocationBalancingRoundSummaryService`
3+
area: Allocation
4+
type: enhancement
5+
issues: []

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,

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ private ModuleEntitlements computeEntitlements(Class<?> requestingClass) {
398398
var pluginName = pluginResolver.apply(requestingClass);
399399
if (pluginName != null) {
400400
var pluginEntitlements = pluginsEntitlements.get(pluginName);
401-
if (pluginEntitlements != null) {
401+
if (pluginEntitlements == null) {
402+
return ModuleEntitlements.NONE;
403+
} else {
402404
final String scopeName;
403405
if (requestingModule.isNamed() == false) {
404406
scopeName = ALL_UNNAMED;

libs/entitlement/src/test/java/org/elasticsearch/entitlement/runtime/policy/PolicyManagerTests.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public void testAgentsEntitlements() throws IOException, ClassNotFoundException
271271
createEmptyTestServerPolicy(),
272272
List.of(new CreateClassLoaderEntitlement()),
273273
Map.of(),
274-
c -> "test",
274+
c -> c.getPackageName().startsWith(TEST_AGENTS_PACKAGE_NAME) ? null : "test",
275275
TEST_AGENTS_PACKAGE_NAME,
276276
NO_ENTITLEMENTS_MODULE
277277
);
@@ -357,6 +357,22 @@ public void testDuplicateFlagEntitlements() {
357357
);
358358
}
359359

360+
/**
361+
* If the plugin resolver tells us a class is in a plugin, don't conclude that it's in an agent.
362+
*/
363+
public void testPluginResolverOverridesAgents() {
364+
var policyManager = new PolicyManager(
365+
createEmptyTestServerPolicy(),
366+
List.of(new CreateClassLoaderEntitlement()),
367+
Map.of(),
368+
c -> "test", // Insist that the class is in a plugin
369+
TEST_AGENTS_PACKAGE_NAME,
370+
NO_ENTITLEMENTS_MODULE
371+
);
372+
ModuleEntitlements notAgentsEntitlements = policyManager.getEntitlements(TestAgent.class);
373+
assertThat(notAgentsEntitlements.hasEntitlement(CreateClassLoaderEntitlement.class), is(false));
374+
}
375+
360376
private static Class<?> makeClassInItsOwnModule() throws IOException, ClassNotFoundException {
361377
final Path home = createTempDir();
362378
Path jar = createMockPluginJar(home);

muted-tests.yml

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ tests:
143143
- class: org.elasticsearch.datastreams.DataStreamsClientYamlTestSuiteIT
144144
method: test {p0=data_stream/120_data_streams_stats/Multiple data stream}
145145
issue: https://github.com/elastic/elasticsearch/issues/118217
146-
- class: org.elasticsearch.action.search.SearchQueryThenFetchAsyncActionTests
147-
method: testBottomFieldSort
148-
issue: https://github.com/elastic/elasticsearch/issues/118214
149146
- class: org.elasticsearch.xpack.searchablesnapshots.RetrySearchIntegTests
150147
method: testSearcherId
151148
issue: https://github.com/elastic/elasticsearch/issues/118374
@@ -335,8 +332,6 @@ tests:
335332
- class: org.elasticsearch.upgrades.VectorSearchIT
336333
method: testBBQVectorSearch {upgradedNodes=0}
337334
issue: https://github.com/elastic/elasticsearch/issues/121253
338-
- class: org.elasticsearch.lucene.FullClusterRestartLuceneIndexCompatibilityIT
339-
issue: https://github.com/elastic/elasticsearch/issues/121257
340335
- class: org.elasticsearch.upgrades.VectorSearchIT
341336
method: testBBQVectorSearch {upgradedNodes=1}
342337
issue: https://github.com/elastic/elasticsearch/issues/121271
@@ -392,6 +387,71 @@ tests:
392387
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
393388
method: testDependentVariableIsAliasToNested
394389
issue: https://github.com/elastic/elasticsearch/issues/121415
390+
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
391+
method: testLookupExplosionBigStringManyMatches
392+
issue: https://github.com/elastic/elasticsearch/issues/121465
393+
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
394+
method: testClientSecretRotation
395+
issue: https://github.com/elastic/elasticsearch/issues/120985
396+
- class: org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests
397+
method: testGrantApiKeyForJWT
398+
issue: https://github.com/elastic/elasticsearch/issues/121039
399+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
400+
method: test {yaml=cluster.health/10_basic/cluster health basic test}
401+
issue: https://github.com/elastic/elasticsearch/issues/121478
402+
- class: org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT
403+
method: testLookupExplosionManyMatches
404+
issue: https://github.com/elastic/elasticsearch/issues/121481
405+
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
406+
method: testGetUsersWithProfileUid
407+
issue: https://github.com/elastic/elasticsearch/issues/121483
408+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
409+
method: test {yaml=cat.aliases/10_basic/Empty cluster}
410+
issue: https://github.com/elastic/elasticsearch/issues/121484
411+
- class: org.elasticsearch.xpack.transform.checkpoint.TransformCCSCanMatchIT
412+
method: testTransformLifecycle_RangeQueryThatMatchesNoShards
413+
issue: https://github.com/elastic/elasticsearch/issues/121480
414+
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT
415+
method: testStopQueryLocal
416+
issue: https://github.com/elastic/elasticsearch/issues/121487
417+
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT
418+
method: testSuccessfulPathways
419+
issue: https://github.com/elastic/elasticsearch/issues/121488
420+
- class: org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT
421+
method: testAsyncQueriesWithLimit0
422+
issue: https://github.com/elastic/elasticsearch/issues/121489
423+
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
424+
method: testSuggestProfilesWithHint
425+
issue: https://github.com/elastic/elasticsearch/issues/121116
426+
- class: org.elasticsearch.xpack.sql.qa.single_node.JdbcDocCsvSpecIT
427+
method: test {docs.testFilterToday}
428+
issue: https://github.com/elastic/elasticsearch/issues/121474
429+
- class: org.elasticsearch.xpack.security.profile.ProfileIntegTests
430+
method: testSuggestProfileWithData
431+
issue: https://github.com/elastic/elasticsearch/issues/121258
432+
- class: org.elasticsearch.ingest.geoip.FullClusterRestartIT
433+
method: testGeoIpSystemFeaturesMigration {cluster=UPGRADED}
434+
issue: https://github.com/elastic/elasticsearch/issues/121115
435+
- class: org.elasticsearch.xpack.core.ilm.SetSingleNodeAllocateStepTests
436+
method: testPerformActionSomeShardsOnlyOnNewNodesButNewNodesInvalidAttrs
437+
issue: https://github.com/elastic/elasticsearch/issues/121495
438+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
439+
method: test {yaml=cat.aliases/40_hidden/Test cat aliases output with a visible index with a hidden alias}
440+
issue: https://github.com/elastic/elasticsearch/issues/121128
441+
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
442+
method: test {p0=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only}
443+
issue: https://github.com/elastic/elasticsearch/issues/121412
444+
- class: org.elasticsearch.xpack.inference.common.InferenceServiceNodeLocalRateLimitCalculatorTests
445+
issue: https://github.com/elastic/elasticsearch/issues/121294
446+
- class: org.elasticsearch.xpack.ml.integration.ClassificationIT
447+
method: testDependentVariableIsAliasToKeyword
448+
issue: https://github.com/elastic/elasticsearch/issues/121492
449+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
450+
method: test {yaml=cat.aliases/10_basic/Complex alias}
451+
issue: https://github.com/elastic/elasticsearch/issues/121513
452+
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
453+
method: test {yaml=snapshot.create/10_basic/Create a snapshot for missing index}
454+
issue: https://github.com/elastic/elasticsearch/issues/121536
395455

396456
# Examples:
397457
#

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)