Skip to content

Commit 6027215

Browse files
authored
Merge branch 'main' into esql_pragma_field_Ex
2 parents 5567e31 + eee890a commit 6027215

File tree

19 files changed

+674
-107
lines changed

19 files changed

+674
-107
lines changed

docs/changelog/124610.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 124610
2+
summary: Remove page alignment in exchange sink
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/124651.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 124651
2+
summary: "Fix system data streams to be restorable from a snapshot"
3+
area: Infra/Core
4+
type: bug
5+
issues: [89261]

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ private static PolicyManager createPolicyManager() {
213213
new FilesEntitlement(serverModuleFileDatas)
214214
)
215215
),
216+
new Scope("java.desktop", List.of(new LoadNativeLibrariesEntitlement())),
216217
new Scope("org.apache.httpcomponents.httpclient", List.of(new OutboundNetworkEntitlement())),
217218
new Scope("io.netty.transport", List.of(new InboundNetworkEntitlement(), new OutboundNetworkEntitlement())),
218219
new Scope(

modules/data-streams/src/main/java/org/elasticsearch/datastreams/action/DeleteDataStreamTransportAction.java

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
import org.elasticsearch.cluster.ProjectState;
2222
import org.elasticsearch.cluster.block.ClusterBlockException;
2323
import org.elasticsearch.cluster.block.ClusterBlockLevel;
24-
import org.elasticsearch.cluster.metadata.DataStream;
2524
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
26-
import org.elasticsearch.cluster.metadata.MetadataDeleteIndexService;
25+
import org.elasticsearch.cluster.metadata.MetadataDataStreamsService;
2726
import org.elasticsearch.cluster.metadata.ProjectMetadata;
2827
import org.elasticsearch.cluster.project.ProjectResolver;
2928
import org.elasticsearch.cluster.service.ClusterService;
@@ -32,11 +31,8 @@
3231
import org.elasticsearch.common.settings.Settings;
3332
import org.elasticsearch.common.util.concurrent.EsExecutors;
3433
import org.elasticsearch.core.SuppressForbidden;
35-
import org.elasticsearch.index.Index;
3634
import org.elasticsearch.indices.SystemIndices;
3735
import org.elasticsearch.injection.guice.Inject;
38-
import org.elasticsearch.snapshots.SnapshotInProgressException;
39-
import org.elasticsearch.snapshots.SnapshotsService;
4036
import org.elasticsearch.tasks.Task;
4137
import org.elasticsearch.threadpool.ThreadPool;
4238
import org.elasticsearch.transport.TransportService;
@@ -46,6 +42,7 @@
4642
import java.util.List;
4743
import java.util.Set;
4844
import java.util.function.Consumer;
45+
import java.util.stream.Collectors;
4946

5047
import static org.elasticsearch.action.datastreams.DataStreamsActionUtil.getDataStreamNames;
5148

@@ -155,34 +152,11 @@ static ClusterState removeDataStream(
155152
}
156153
}
157154

158-
Set<String> snapshottingDataStreams = SnapshotsService.snapshottingDataStreams(projectState, dataStreams);
159-
if (snapshottingDataStreams.isEmpty() == false) {
160-
throw new SnapshotInProgressException(
161-
"Cannot delete data streams that are being snapshotted: "
162-
+ snapshottingDataStreams
163-
+ ". Try again after snapshot finishes or cancel the currently running snapshot."
164-
);
165-
}
166-
167-
Set<Index> backingIndicesToRemove = new HashSet<>();
168-
for (String dataStreamName : dataStreams) {
169-
DataStream dataStream = project.dataStreams().get(dataStreamName);
170-
assert dataStream != null;
171-
backingIndicesToRemove.addAll(dataStream.getIndices());
172-
backingIndicesToRemove.addAll(dataStream.getFailureIndices());
173-
}
174-
175-
// first delete the data streams and then the indices:
176-
// (this to avoid data stream validation from failing when deleting an index that is part of a data stream
177-
// without updating the data stream)
178-
// TODO: change order when delete index api also updates the data stream the index to be removed is member of
179-
ClusterState newState = projectState.updatedState(builder -> {
180-
for (String ds : dataStreams) {
181-
LOGGER.info("removing data stream [{}]", ds);
182-
builder.removeDataStream(ds);
183-
}
184-
});
185-
return MetadataDeleteIndexService.deleteIndices(newState.projectState(projectState.projectId()), backingIndicesToRemove, settings);
155+
return MetadataDataStreamsService.deleteDataStreams(
156+
projectState,
157+
dataStreams.stream().map(project.dataStreams()::get).collect(Collectors.toSet()),
158+
settings
159+
);
186160
}
187161

188162
@Override

muted-tests.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,6 @@ tests:
342342
- class: org.elasticsearch.xpack.ilm.DataStreamAndIndexLifecycleMixingTests
343343
method: testUpdateIndexTemplateToDataStreamLifecyclePreference
344344
issue: https://github.com/elastic/elasticsearch/issues/124837
345-
- class: org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateInlineEvalsTests
346-
method: testGroupingAliasingMoved_To_LeftSideOfJoin
347-
issue: https://github.com/elastic/elasticsearch/issues/124839
348-
- class: org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateInlineEvalsTests
349-
method: testGroupingAliasingMoved_To_LeftSideOfJoin_WithExpression
350-
issue: https://github.com/elastic/elasticsearch/issues/124838
351345
- class: org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleServiceIT
352346
method: testAutomaticForceMerge
353347
issue: https://github.com/elastic/elasticsearch/issues/124846

qa/ccs-unavailable-clusters/src/javaRestTest/java/org/elasticsearch/search/CrossClusterSearchUnavailableClusterIT.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,12 @@ private static MockTransportService startTransport(
9191
EsExecutors.DIRECT_EXECUTOR_SERVICE,
9292
SearchShardsRequest::new,
9393
(request, channel, task) -> {
94-
channel.sendResponse(new SearchShardsResponse(List.of(), List.of(), Collections.emptyMap()));
94+
var searchShardsResponse = new SearchShardsResponse(List.of(), List.of(), Collections.emptyMap());
95+
try {
96+
channel.sendResponse(searchShardsResponse);
97+
} finally {
98+
searchShardsResponse.decRef();
99+
}
95100
}
96101
);
97102
newService.registerRequestHandler(
@@ -119,7 +124,12 @@ private static MockTransportService startTransport(
119124
builder.add(node);
120125
}
121126
ClusterState build = ClusterState.builder(clusterName).nodes(builder.build()).build();
122-
channel.sendResponse(new ClusterStateResponse(clusterName, build, false));
127+
var clusterStateResponse = new ClusterStateResponse(clusterName, build, false);
128+
try {
129+
channel.sendResponse(clusterStateResponse);
130+
} finally {
131+
clusterStateResponse.decRef();
132+
}
123133
}
124134
);
125135
newService.start();

server/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ dependencies {
8080
}
8181
internalClusterTestImplementation(project(':modules:reindex'))
8282
internalClusterTestImplementation(project(':modules:mapper-extras'))
83+
internalClusterTestImplementation(project(':modules:data-streams'))
8384
}
8485

8586
spotless {

server/src/internalClusterTest/java/org/elasticsearch/action/admin/indices/create/AutoCreateSystemIndexIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.elasticsearch.indices.TestSystemIndexPlugin;
2929
import org.elasticsearch.plugins.Plugin;
3030
import org.elasticsearch.plugins.SystemIndexPlugin;
31-
import org.elasticsearch.snapshots.SystemIndicesSnapshotIT;
31+
import org.elasticsearch.snapshots.SystemResourceSnapshotIT;
3232
import org.elasticsearch.test.ESIntegTestCase;
3333
import org.elasticsearch.xcontent.XContentType;
3434
import org.junit.After;
@@ -300,7 +300,7 @@ public Collection<SystemIndexDescriptor> getSystemIndexDescriptors(Settings sett
300300

301301
@Override
302302
public String getFeatureName() {
303-
return SystemIndicesSnapshotIT.SystemIndexTestPlugin.class.getSimpleName();
303+
return SystemResourceSnapshotIT.SystemIndexTestPlugin.class.getSimpleName();
304304
}
305305

306306
@Override

0 commit comments

Comments
 (0)