Skip to content

Commit ac2b530

Browse files
Merge branch 'main' into charlotte-releasenote-tagging
2 parents 22844b3 + feb99ea commit ac2b530

File tree

72 files changed

+4741
-3252
lines changed

Some content is hidden

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

72 files changed

+4741
-3252
lines changed

docs/changelog/133681.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 133681
2+
summary: Remove `DocumentSubsetBitsetCache` locking
3+
area: Authorization
4+
type: bug
5+
issues:
6+
- 132842

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ static TransportVersion def(int id) {
369369
public static final TransportVersion SCRIPT_RESCORER = def(9_143_0_00);
370370
public static final TransportVersion ESQL_LOOKUP_OPERATOR_EMITTED_ROWS = def(9_144_0_00);
371371
public static final TransportVersion ALLOCATION_DECISION_NOT_PREFERRED = def(9_145_0_00);
372+
public static final TransportVersion ESQL_QUALIFIERS_IN_ATTRIBUTES = def(9_146_0_00);
372373

373374
/*
374375
* STOP! READ THIS FIRST! No, really,

server/src/main/java/org/elasticsearch/node/NodeConstruction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,8 @@ public Map<String, String> queryFields() {
11211121
settingsModule.getClusterSettings(),
11221122
taskManager,
11231123
telemetryProvider.getTracer(),
1124-
nodeEnvironment.nodeId()
1124+
nodeEnvironment.nodeId(),
1125+
projectResolver
11251126
);
11261127
final SearchResponseMetrics searchResponseMetrics = new SearchResponseMetrics(telemetryProvider.getMeterRegistry());
11271128
final SearchTransportService searchTransportService = new SearchTransportService(

server/src/main/java/org/elasticsearch/node/NodeServiceProvider.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.elasticsearch.tasks.TaskManager;
4343
import org.elasticsearch.telemetry.tracing.Tracer;
4444
import org.elasticsearch.threadpool.ThreadPool;
45+
import org.elasticsearch.transport.ClusterConnectionManager;
4546
import org.elasticsearch.transport.Transport;
4647
import org.elasticsearch.transport.TransportInterceptor;
4748
import org.elasticsearch.transport.TransportService;
@@ -119,9 +120,20 @@ TransportService newTransportService(
119120
ClusterSettings clusterSettings,
120121
TaskManager taskManager,
121122
Tracer tracer,
122-
String nodeId
123+
String nodeId,
124+
ProjectResolver projectResolver
123125
) {
124-
return new TransportService(settings, transport, threadPool, interceptor, localNodeFactory, clusterSettings, taskManager);
126+
return new TransportService(
127+
settings,
128+
transport,
129+
threadPool,
130+
interceptor,
131+
localNodeFactory,
132+
clusterSettings,
133+
new ClusterConnectionManager(settings, transport, threadPool.getThreadContext()),
134+
taskManager,
135+
projectResolver
136+
);
125137
}
126138

127139
HttpServerTransport newHttpTransport(PluginsService pluginsService, NetworkModule networkModule) {

server/src/main/java/org/elasticsearch/transport/RemoteClusterService.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.elasticsearch.cluster.metadata.ProjectId;
2525
import org.elasticsearch.cluster.node.DiscoveryNode;
2626
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
27-
import org.elasticsearch.cluster.project.DefaultProjectResolver;
2827
import org.elasticsearch.cluster.project.ProjectResolver;
2928
import org.elasticsearch.common.Strings;
3029
import org.elasticsearch.common.settings.ClusterSettings;
@@ -85,15 +84,14 @@ public boolean isRemoteClusterServerEnabled() {
8584
private final ProjectResolver projectResolver;
8685
private final boolean canUseSkipUnavailable;
8786

88-
@FixForMultiProject(description = "Inject the ProjectResolver instance.")
89-
RemoteClusterService(Settings settings, TransportService transportService) {
87+
RemoteClusterService(Settings settings, TransportService transportService, ProjectResolver projectResolver) {
9088
super(settings);
9189
this.isRemoteClusterClient = DiscoveryNode.isRemoteClusterClient(settings);
9290
this.isSearchNode = DiscoveryNode.hasRole(settings, DiscoveryNodeRole.SEARCH_ROLE);
9391
this.isStateless = DiscoveryNode.isStateless(settings);
9492
this.remoteClusterServerEnabled = REMOTE_CLUSTER_SERVER_ENABLED.get(settings);
9593
this.transportService = transportService;
96-
this.projectResolver = DefaultProjectResolver.INSTANCE;
94+
this.projectResolver = projectResolver;
9795
this.remoteClusters = projectResolver.supportsMultipleProjects()
9896
? ConcurrentCollections.newConcurrentMap()
9997
: Map.of(ProjectId.DEFAULT, ConcurrentCollections.newConcurrentMap());
@@ -694,9 +692,9 @@ private Map<String, RemoteClusterConnection> getConnectionsMapForCurrentProject(
694692
/**
695693
* Returns the map of connections for the given {@link ProjectId}.
696694
*/
695+
@FixForMultiProject(description = "Assert ProjectId.DEFAULT should not be used in multi-project environment")
697696
private Map<String, RemoteClusterConnection> getConnectionsMapForProject(ProjectId projectId) {
698697
if (projectResolver.supportsMultipleProjects()) {
699-
assert ProjectId.DEFAULT.equals(projectId) == false : "The default project ID should not be used in multi-project environment";
700698
return remoteClusters.computeIfAbsent(projectId, unused -> ConcurrentCollections.newConcurrentMap());
701699
}
702700
assert ProjectId.DEFAULT.equals(projectId) : "Only the default project ID should be used when multiple projects are not supported";

server/src/main/java/org/elasticsearch/transport/TransportService.java

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import org.elasticsearch.action.ActionListenerResponseHandler;
1919
import org.elasticsearch.cluster.ClusterName;
2020
import org.elasticsearch.cluster.node.DiscoveryNode;
21+
import org.elasticsearch.cluster.project.DefaultProjectResolver;
22+
import org.elasticsearch.cluster.project.ProjectResolver;
2123
import org.elasticsearch.common.ReferenceDocs;
2224
import org.elasticsearch.common.Strings;
2325
import org.elasticsearch.common.component.AbstractLifecycleComponent;
@@ -232,7 +234,7 @@ public TransportService(
232234
);
233235
}
234236

235-
// NOTE: Only for use in tests
237+
// Public access for tests.
236238
public TransportService(
237239
Settings settings,
238240
Transport transport,
@@ -249,12 +251,11 @@ public TransportService(
249251
transportInterceptor,
250252
localNodeFactory,
251253
clusterSettings,
252-
new ClusterConnectionManager(settings, transport, threadPool.getThreadContext()),
253254
new TaskManager(settings, threadPool, taskHeaders)
254255
);
255256
}
256257

257-
@SuppressWarnings("this-escape")
258+
// Public access for tests.
258259
public TransportService(
259260
Settings settings,
260261
Transport transport,
@@ -264,6 +265,31 @@ public TransportService(
264265
@Nullable ClusterSettings clusterSettings,
265266
ConnectionManager connectionManager,
266267
TaskManager taskManger
268+
) {
269+
this(
270+
settings,
271+
transport,
272+
threadPool,
273+
transportInterceptor,
274+
localNodeFactory,
275+
clusterSettings,
276+
connectionManager,
277+
taskManger,
278+
DefaultProjectResolver.INSTANCE
279+
);
280+
}
281+
282+
@SuppressWarnings("this-escape")
283+
public TransportService(
284+
Settings settings,
285+
Transport transport,
286+
ThreadPool threadPool,
287+
TransportInterceptor transportInterceptor,
288+
Function<BoundTransportAddress, DiscoveryNode> localNodeFactory,
289+
@Nullable ClusterSettings clusterSettings,
290+
ConnectionManager connectionManager,
291+
TaskManager taskManger,
292+
ProjectResolver projectResolver
267293
) {
268294
this.transport = transport;
269295
transport.setSlowLogThreshold(TransportSettings.SLOW_OPERATION_THRESHOLD_SETTING.get(settings));
@@ -278,7 +304,7 @@ public TransportService(
278304
this.asyncSender = interceptor.interceptSender(this::sendRequestInternal);
279305
this.remoteClusterClient = DiscoveryNode.isRemoteClusterClient(settings);
280306
this.enableStackOverflowAvoidance = ENABLE_STACK_OVERFLOW_AVOIDANCE.get(settings);
281-
remoteClusterService = new RemoteClusterService(settings, this);
307+
remoteClusterService = new RemoteClusterService(settings, this, projectResolver);
282308
responseHandlers = transport.getResponseHandlers();
283309
if (clusterSettings != null) {
284310
clusterSettings.addSettingsUpdateConsumer(TransportSettings.TRACE_LOG_INCLUDE_SETTING, this::setTracerLogInclude);

0 commit comments

Comments
 (0)