Skip to content

Commit 1d3106f

Browse files
committed
Merge branch 'feature/multi-project'
2 parents e6eb8ef + 783ce7a commit 1d3106f

File tree

1,269 files changed

+39126
-15820
lines changed

Some content is hidden

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

1,269 files changed

+39126
-15820
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/indices/resolution/IndexNameExpressionResolverBenchmark.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.elasticsearch.cluster.metadata.IndexMetadata;
1818
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
1919
import org.elasticsearch.cluster.metadata.Metadata;
20+
import org.elasticsearch.cluster.project.DefaultProjectResolver;
2021
import org.elasticsearch.common.settings.Settings;
2122
import org.elasticsearch.common.util.concurrent.ThreadContext;
2223
import org.elasticsearch.index.Index;
@@ -84,7 +85,11 @@ public void setUp() {
8485
}
8586
int mid = indices.length / 2;
8687
clusterState = ClusterState.builder(ClusterName.DEFAULT).metadata(mb).build();
87-
resolver = new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY), new SystemIndices(List.of()));
88+
resolver = new IndexNameExpressionResolver(
89+
new ThreadContext(Settings.EMPTY),
90+
new SystemIndices(List.of()),
91+
DefaultProjectResolver.INSTANCE
92+
);
8893
indexListRequest = new Request(IndicesOptions.lenientExpandOpenHidden(), indices);
8994
starRequest = new Request(IndicesOptions.lenientExpandOpenHidden(), "*");
9095
String[] mixed = indices.clone();

benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/AllocationBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void setUp() throws Exception {
138138
Metadata metadata = mb.build();
139139
RoutingTable.Builder rb = RoutingTable.builder(TestShardRoutingRoleStrategies.DEFAULT_ROLE_ONLY);
140140
for (int i = 1; i <= numIndices; i++) {
141-
rb.addAsNew(metadata.index("test_" + i));
141+
rb.addAsNew(metadata.getProject().index("test_" + i));
142142
}
143143
RoutingTable routingTable = rb.build();
144144
DiscoveryNodes.Builder nb = DiscoveryNodes.builder();
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.core;
11+
12+
import java.lang.annotation.ElementType;
13+
import java.lang.annotation.Retention;
14+
import java.lang.annotation.RetentionPolicy;
15+
import java.lang.annotation.Target;
16+
17+
/**
18+
* Annotation to identify a block of code (a whole class, a method, a field, or a local variable) that needs to be reviewed (for cleanup,
19+
* removal or change) before merging the multi-project branch into main
20+
*/
21+
@Retention(RetentionPolicy.SOURCE)
22+
@Target(
23+
{ ElementType.LOCAL_VARIABLE, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.MODULE }
24+
)
25+
public @interface FixForMultiProject {
26+
27+
/**
28+
* Some explanation on what and why for the future fix
29+
*/
30+
String description() default "";
31+
}

libs/x-content/src/main/java/org/elasticsearch/xcontent/NamedXContentRegistry.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,19 @@ public <T, C> T parseNamedObject(Class<T> categoryClass, String name, XContentPa
149149
return categoryClass.cast(entry.parser.parse(parser, context));
150150
}
151151

152+
/**
153+
* Returns {@code true} if this registry is able to {@link #parseNamedObject parse} the referenced object, false otherwise.
154+
* Note: This method does not throw exceptions, even if the {@link RestApiVersion} or {@code categoryClass} are unknown.
155+
*/
156+
public boolean hasParser(Class<?> categoryClass, String name, RestApiVersion apiVersion) {
157+
final Map<Class<?>, Map<String, Entry>> versionMap = registry.get(apiVersion);
158+
if (versionMap == null) {
159+
return false;
160+
}
161+
final Map<String, Entry> parsers = versionMap.get(categoryClass);
162+
return parsers != null && parsers.containsKey(name);
163+
}
164+
152165
// scope for testing
153166
public <T> Entry lookupParser(Class<T> categoryClass, String name, XContentParser parser) {
154167
Map<String, Entry> parsers = registry.getOrDefault(parser.getRestApiVersion(), emptyMap()).get(categoryClass);

modules/data-streams/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,15 @@ tasks.named("yamlRestCompatTestTransform").configure({ task ->
8484
task.skipTest("data_stream/210_rollover_failure_store/Lazily roll over a data stream's failure store after a shard failure", "Rolling over a data stream using target_failure_store is no longer supported.")
8585
task.skipTest("data_stream/210_rollover_failure_store/Roll over a data stream's failure store without conditions", "Rolling over a data stream using target_failure_store is no longer supported.")
8686
})
87+
88+
configurations {
89+
basicRestSpecs {
90+
attributes {
91+
attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, ArtifactTypeDefinition.DIRECTORY_TYPE)
92+
}
93+
}
94+
}
95+
96+
artifacts {
97+
basicRestSpecs(new File(projectDir, "src/yamlRestTest/resources/rest-api-spec/test"))
98+
}

0 commit comments

Comments
 (0)