Skip to content

Commit 8d72e21

Browse files
Merge branch 'main' into svilen/121525
2 parents 6f75f30 + 4f019d1 commit 8d72e21

File tree

100 files changed

+2299
-993
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

+2299
-993
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
3737
map.put(LegacyRestTestBasePlugin.class, ":qa:repository-multi-version");
3838
map.put(LegacyRestTestBasePlugin.class, ":qa:rolling-upgrade-legacy");
3939
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
40-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:logstash");
41-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile");
4240
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:mixed-tier-cluster");
4341
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:repository-old-versions");
4442
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:rolling-upgrade");
@@ -60,12 +58,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
6058
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:slack");
6159
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:async-search:qa:rest");
6260
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:autoscaling:qa:rest");
63-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:downgrade-to-basic-license");
64-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:multi-cluster");
65-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:non-compliant-license");
66-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:rest");
67-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:restart");
68-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:security");
6961
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:early-deprecation-rest");
7062
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:rest");
7163
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:with-security");
@@ -92,8 +84,6 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
9284
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:tls-basic");
9385
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:multi-node");
9486
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:rolling-upgrade");
95-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:multi-node");
96-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:rest");
9787
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:fs");
9888
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:license-enforcing");
9989
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:hdfs");
@@ -106,12 +96,10 @@ private static ListMultimap<Class<?>, String> createLegacyRestTestBasePluginUsag
10696
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:mixed-node");
10797
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:with-ssl");
10898
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:without-ssl");
109-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:stack:qa:rest");
11099
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:text-structure:qa:text-structure-with-security");
111100
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-cluster-tests-with-security");
112101
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-node-tests");
113102
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:single-node-tests");
114-
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile:qa:multi-cluster");
115103
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:rest");
116104
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:with-security");
117105
return map;

docs/changelog/125916.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125916
2+
summary: Re-enable parallel collection for field sorted top hits
3+
area: Search
4+
type: bug
5+
issues: []

docs/changelog/125930.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 125930
2+
summary: Infer the score mode to use from the Lucene collector
3+
area: "ES|QL"
4+
type: enhancement
5+
issues: []

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
import java.util.stream.StreamSupport;
6969

7070
import static org.elasticsearch.entitlement.runtime.policy.Platform.LINUX;
71+
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.BaseDir.CONFIG;
7172
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.BaseDir.DATA;
7273
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.BaseDir.SHARED_REPO;
7374
import static org.elasticsearch.entitlement.runtime.policy.entitlements.FilesEntitlement.Mode.READ;
@@ -182,7 +183,8 @@ private static PolicyManager createPolicyManager() {
182183
FileData.ofPath(bootstrapArgs.libDir(), READ),
183184
FileData.ofRelativePath(Path.of(""), DATA, READ_WRITE),
184185
FileData.ofRelativePath(Path.of(""), SHARED_REPO, READ_WRITE),
185-
186+
// exclusive settings file
187+
FileData.ofRelativePath(Path.of("operator/settings.json"), CONFIG, READ_WRITE).withExclusive(true),
186188
// OS release on Linux
187189
FileData.ofPath(Path.of("/etc/os-release"), READ).withPlatform(LINUX),
188190
FileData.ofPath(Path.of("/etc/system-release"), READ).withPlatform(LINUX),

modules/ingest-geoip/src/internalClusterTest/java/org/elasticsearch/ingest/geoip/EnterpriseGeoIpDownloaderIT.java

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.elasticsearch.ExceptionsHelper;
1515
import org.elasticsearch.ResourceAlreadyExistsException;
1616
import org.elasticsearch.action.ActionListener;
17+
import org.elasticsearch.action.LatchedActionListener;
1718
import org.elasticsearch.action.bulk.BulkItemResponse;
1819
import org.elasticsearch.action.bulk.BulkRequest;
1920
import org.elasticsearch.action.bulk.BulkResponse;
@@ -22,13 +23,16 @@
2223
import org.elasticsearch.action.index.IndexRequest;
2324
import org.elasticsearch.action.search.SearchRequest;
2425
import org.elasticsearch.action.search.SearchResponse;
26+
import org.elasticsearch.action.support.SubscribableListener;
27+
import org.elasticsearch.action.support.master.AcknowledgedResponse;
2528
import org.elasticsearch.common.Strings;
2629
import org.elasticsearch.common.settings.MockSecureSettings;
2730
import org.elasticsearch.common.settings.Settings;
2831
import org.elasticsearch.common.util.CollectionUtils;
2932
import org.elasticsearch.core.TimeValue;
3033
import org.elasticsearch.ingest.EnterpriseGeoIpTask;
3134
import org.elasticsearch.ingest.geoip.direct.DatabaseConfiguration;
35+
import org.elasticsearch.ingest.geoip.direct.DeleteDatabaseConfigurationAction;
3236
import org.elasticsearch.ingest.geoip.direct.PutDatabaseConfigurationAction;
3337
import org.elasticsearch.persistent.PersistentTasksService;
3438
import org.elasticsearch.plugins.Plugin;
@@ -38,12 +42,15 @@
3842
import org.elasticsearch.test.junit.annotations.TestLogging;
3943
import org.elasticsearch.transport.RemoteTransportException;
4044
import org.elasticsearch.xcontent.XContentType;
45+
import org.junit.After;
4146
import org.junit.ClassRule;
4247

4348
import java.io.IOException;
4449
import java.util.Collection;
4550
import java.util.List;
4651
import java.util.Map;
52+
import java.util.concurrent.CountDownLatch;
53+
import java.util.concurrent.TimeUnit;
4754

4855
import static org.elasticsearch.ingest.EnterpriseGeoIpTask.ENTERPRISE_GEOIP_DOWNLOADER;
4956
import static org.elasticsearch.ingest.geoip.EnterpriseGeoIpDownloaderTaskExecutor.IPINFO_TOKEN_SETTING;
@@ -54,6 +61,8 @@ public class EnterpriseGeoIpDownloaderIT extends ESIntegTestCase {
5461

5562
private static final String MAXMIND_DATABASE_TYPE = "GeoIP2-City";
5663
private static final String IPINFO_DATABASE_TYPE = "asn";
64+
private static final String MAXMIND_CONFIGURATION = "test-1";
65+
private static final String IPINFO_CONFIGURATION = "test-2";
5766

5867
@ClassRule
5968
public static final EnterpriseGeoIpHttpFixture fixture = new EnterpriseGeoIpHttpFixture(
@@ -140,6 +149,28 @@ public void testEnterpriseDownloaderTask() throws Exception {
140149
});
141150
}
142151

152+
@After
153+
public void cleanup() throws InterruptedException {
154+
/*
155+
* This method cleans up the database configurations that the test created. This allows the test to be run repeatedly.
156+
*/
157+
CountDownLatch latch = new CountDownLatch(1);
158+
LatchedActionListener<AcknowledgedResponse> listener = new LatchedActionListener<>(ActionListener.noop(), latch);
159+
SubscribableListener.<AcknowledgedResponse>newForked(l -> deleteDatabaseConfiguration(MAXMIND_CONFIGURATION, l))
160+
.<AcknowledgedResponse>andThen(l -> deleteDatabaseConfiguration(IPINFO_CONFIGURATION, l))
161+
.addListener(listener);
162+
latch.await(10, TimeUnit.SECONDS);
163+
}
164+
165+
private void deleteDatabaseConfiguration(String configurationName, ActionListener<AcknowledgedResponse> listener) {
166+
admin().cluster()
167+
.execute(
168+
DeleteDatabaseConfigurationAction.INSTANCE,
169+
new DeleteDatabaseConfigurationAction.Request(TimeValue.MAX_VALUE, TimeValue.timeValueSeconds(10), configurationName),
170+
listener
171+
);
172+
}
173+
143174
private void startEnterpriseGeoIpDownloaderTask() {
144175
PersistentTasksService persistentTasksService = internalCluster().getInstance(PersistentTasksService.class);
145176
persistentTasksService.sendStartRequest(
@@ -163,7 +194,7 @@ private void configureMaxmindDatabase(String databaseType) {
163194
new PutDatabaseConfigurationAction.Request(
164195
TimeValue.MAX_VALUE,
165196
TimeValue.MAX_VALUE,
166-
new DatabaseConfiguration("test-1", databaseType, new DatabaseConfiguration.Maxmind("test_account"))
197+
new DatabaseConfiguration(MAXMIND_CONFIGURATION, databaseType, new DatabaseConfiguration.Maxmind("test_account"))
167198
)
168199
)
169200
.actionGet();
@@ -176,7 +207,7 @@ private void configureIpinfoDatabase(String databaseType) {
176207
new PutDatabaseConfigurationAction.Request(
177208
TimeValue.MAX_VALUE,
178209
TimeValue.MAX_VALUE,
179-
new DatabaseConfiguration("test-2", databaseType, new DatabaseConfiguration.Ipinfo())
210+
new DatabaseConfiguration(IPINFO_CONFIGURATION, databaseType, new DatabaseConfiguration.Ipinfo())
180211
)
181212
)
182213
.actionGet();

muted-tests.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,18 +344,12 @@ tests:
344344
- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT
345345
method: testSearchableSnapshotsInHotPhasePinnedToHotNodes
346346
issue: https://github.com/elastic/elasticsearch/issues/125683
347-
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
348-
method: test {p0=cat.allocation/10_basic/Node forecasts}
349-
issue: https://github.com/elastic/elasticsearch/issues/125711
350347
- class: org.elasticsearch.xpack.migrate.action.ReindexDataStreamTransportActionIT
351348
method: testAlreadyUpToDateDataStream
352349
issue: https://github.com/elastic/elasticsearch/issues/125727
353350
- class: org.elasticsearch.index.engine.ThreadPoolMergeSchedulerStressTestIT
354351
method: testMergingFallsBehindAndThenCatchesUp
355352
issue: https://github.com/elastic/elasticsearch/issues/125744
356-
- class: org.elasticsearch.test.rest.ClientYamlTestSuiteIT
357-
method: test {yaml=cat.allocation/10_basic/Node forecasts}
358-
issue: https://github.com/elastic/elasticsearch/issues/125661
359353
- class: org.elasticsearch.xpack.esql.spatial.SpatialExtentAggregationNoLicenseIT
360354
method: testStExtentAggregationWithPoints
361355
issue: https://github.com/elastic/elasticsearch/issues/125735
@@ -380,9 +374,6 @@ tests:
380374
- class: org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT
381375
method: test {yaml=search.vectors/41_knn_search_bbq_hnsw/Test index configured rescore vector score consistency}
382376
issue: https://github.com/elastic/elasticsearch/issues/125902
383-
- class: org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT
384-
method: test {yaml=cat.allocation/10_basic/Node forecasts}
385-
issue: https://github.com/elastic/elasticsearch/issues/125848
386377
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
387378
method: test {p0=ml/start_data_frame_analytics/Test start given dest index is not empty}
388379
issue: https://github.com/elastic/elasticsearch/issues/125909
@@ -398,6 +389,12 @@ tests:
398389
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
399390
method: test {p0=transform/transforms_stats/Test get transform stats with timeout}
400391
issue: https://github.com/elastic/elasticsearch/issues/125975
392+
- class: org.elasticsearch.search.SearchServiceSingleNodeTests
393+
method: testSlicingBehaviourForParallelCollection
394+
issue: https://github.com/elastic/elasticsearch/issues/125899
395+
- class: org.elasticsearch.packaging.test.DockerTests
396+
method: test021InstallPlugin
397+
issue: https://github.com/elastic/elasticsearch/issues/116147
401398

402399
# Examples:
403400
#

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cat.allocation/10_basic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@
295295
( [-\w.]+ \s+
296296
[-\w.]+ \s+
297297
[-\w.]+ \s+
298-
[\w]+
298+
[-\w.]+
299299
\n
300300
)+
301301
$/

server/src/main/java/org/elasticsearch/action/ResolvedIndices.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
import org.elasticsearch.action.search.SearchContextId;
1313
import org.elasticsearch.action.support.IndicesOptions;
14+
import org.elasticsearch.cluster.metadata.DataStream;
1415
import org.elasticsearch.cluster.metadata.IndexMetadata;
1516
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
1617
import org.elasticsearch.cluster.metadata.ProjectMetadata;
1718
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
1819
import org.elasticsearch.core.Nullable;
1920
import org.elasticsearch.index.Index;
2021
import org.elasticsearch.index.IndexNotFoundException;
22+
import org.elasticsearch.indices.InvalidIndexNameException;
2123
import org.elasticsearch.search.builder.PointInTimeBuilder;
2224
import org.elasticsearch.transport.RemoteClusterAware;
2325
import org.elasticsearch.transport.RemoteClusterService;
@@ -176,6 +178,20 @@ public static ResolvedIndices resolveWithIndexNamesAndOptions(
176178
? Index.EMPTY_ARRAY
177179
: indexNameExpressionResolver.concreteIndices(projectMetadata, localIndices, startTimeInMillis);
178180

181+
// prevent using selectors with remote cluster patterns
182+
if (DataStream.isFailureStoreFeatureFlagEnabled()) {
183+
for (final var indicesPerRemoteClusterAlias : remoteClusterIndices.entrySet()) {
184+
final String[] indices = indicesPerRemoteClusterAlias.getValue().indices();
185+
if (indices != null) {
186+
for (final String index : indices) {
187+
if (IndexNameExpressionResolver.hasSelectorSuffix(index)) {
188+
throw new InvalidIndexNameException(index, "Selectors are not yet supported on remote cluster patterns");
189+
}
190+
}
191+
}
192+
}
193+
}
194+
179195
return new ResolvedIndices(
180196
remoteClusterIndices,
181197
localIndices,

server/src/main/java/org/elasticsearch/common/file/AbstractFileWatchingService.java

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
import org.elasticsearch.core.FixForMultiProject;
1717

1818
import java.io.IOException;
19+
import java.io.InputStream;
1920
import java.nio.file.ClosedWatchServiceException;
20-
import java.nio.file.Files;
2121
import java.nio.file.NoSuchFileException;
2222
import java.nio.file.Path;
2323
import java.nio.file.StandardWatchEventKinds;
2424
import java.nio.file.WatchEvent;
2525
import java.nio.file.WatchKey;
2626
import java.nio.file.WatchService;
2727
import java.nio.file.attribute.BasicFileAttributes;
28+
import java.nio.file.attribute.FileTime;
2829
import java.util.HashMap;
2930
import java.util.HashSet;
3031
import java.util.List;
@@ -62,8 +63,9 @@ public abstract class AbstractFileWatchingService extends AbstractLifecycleCompo
6263
private WatchKey settingsDirWatchKey;
6364
private WatchKey configDirWatchKey;
6465

66+
@SuppressWarnings("this-escape")
6567
public AbstractFileWatchingService(Path settingsDir) {
66-
if (Files.exists(settingsDir) && Files.isDirectory(settingsDir) == false) {
68+
if (filesExists(settingsDir) && filesIsDirectory(settingsDir) == false) {
6769
throw new IllegalArgumentException("settingsDir should be a directory");
6870
}
6971
this.settingsDir = settingsDir;
@@ -113,10 +115,10 @@ public final boolean watching() {
113115
return watcherThread != null;
114116
}
115117

116-
private static FileUpdateState readFileUpdateState(Path path) throws IOException {
118+
private FileUpdateState readFileUpdateState(Path path) throws IOException {
117119
BasicFileAttributes attr;
118120
try {
119-
attr = Files.readAttributes(path, BasicFileAttributes.class);
121+
attr = filesReadAttributes(path, BasicFileAttributes.class);
120122
} catch (NoSuchFileException e) {
121123
// file doesn't exist anymore
122124
return null;
@@ -141,7 +143,7 @@ final boolean fileChanged(Path path) throws IOException {
141143
}
142144

143145
protected final synchronized void startWatcher() {
144-
if (Files.exists(settingsDir.getParent()) == false) {
146+
if (filesExists(settingsDir.getParent()) == false) {
145147
logger.warn("File watcher for [{}] cannot start because parent directory does not exist", settingsDir);
146148
return;
147149
}
@@ -155,7 +157,7 @@ protected final synchronized void startWatcher() {
155157
*/
156158
try {
157159
this.watchService = settingsDir.getParent().getFileSystem().newWatchService();
158-
if (Files.exists(settingsDir)) {
160+
if (filesExists(settingsDir)) {
159161
settingsDirWatchKey = enableDirectoryWatcher(settingsDirWatchKey, settingsDir);
160162
} else {
161163
logger.debug("watched directory [{}] not found, will watch for its creation...", settingsDir);
@@ -188,8 +190,8 @@ protected final void watcherThread() {
188190
try {
189191
logger.info("file settings service up and running [tid={}]", Thread.currentThread().getId());
190192

191-
if (Files.exists(settingsDir)) {
192-
try (Stream<Path> files = Files.list(settingsDir)) {
193+
if (filesExists(settingsDir)) {
194+
try (Stream<Path> files = filesList(settingsDir)) {
193195
var f = files.iterator();
194196
if (f.hasNext() == false) {
195197
// no files in directory
@@ -248,7 +250,7 @@ protected final void watcherThread() {
248250
}
249251
}
250252
} else if (key == configDirWatchKey) {
251-
if (Files.exists(settingsDir)) {
253+
if (filesExists(settingsDir)) {
252254
// We re-register the settings directory watch key, because we don't know
253255
// if the file name maps to the same native file system file id. Symlinks
254256
// are one potential cause of inconsistency here, since their handling by
@@ -257,7 +259,7 @@ protected final void watcherThread() {
257259
settingsDirWatchKey = enableDirectoryWatcher(settingsDirWatchKey, settingsDir);
258260

259261
// re-read the settings directory, and ping for any changes
260-
try (Stream<Path> files = Files.list(settingsDir)) {
262+
try (Stream<Path> files = filesList(settingsDir)) {
261263
for (var f = files.iterator(); f.hasNext();) {
262264
Path file = f.next();
263265
if (fileChanged(file)) {
@@ -370,4 +372,19 @@ long retryDelayMillis(int failedCount) {
370372
* class to determine if a file has been changed.
371373
*/
372374
private record FileUpdateState(long timestamp, String path, Object fileKey) {}
375+
376+
// the following methods are a workaround to ensure exclusive access for files
377+
// required by child watchers; this is required because we only check the caller's module
378+
// not the entire stack
379+
protected abstract boolean filesExists(Path path);
380+
381+
protected abstract boolean filesIsDirectory(Path path);
382+
383+
protected abstract <A extends BasicFileAttributes> A filesReadAttributes(Path path, Class<A> clazz) throws IOException;
384+
385+
protected abstract Stream<Path> filesList(Path dir) throws IOException;
386+
387+
protected abstract Path filesSetLastModifiedTime(Path path, FileTime time) throws IOException;
388+
389+
protected abstract InputStream filesNewInputStream(Path path) throws IOException;
373390
}

0 commit comments

Comments
 (0)