Skip to content

Commit

Permalink
Merge branch 'main' into fix/114385
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Oct 23, 2024
2 parents c5425d4 + 98d5335 commit c198397
Show file tree
Hide file tree
Showing 166 changed files with 3,887 additions and 1,682 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/114951.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 114951
summary: Expose cluster-state role mappings in APIs
area: Authentication
type: bug
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/115041.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 115041
summary: Increase default `queue_capacity` to 10_000 and decrease max `queue_capacity`
to 100_000
area: Machine Learning
type: enhancement
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/115102.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 115102
summary: Watch Next Run Interval Resets On Shard Move or Node Restart
area: Watcher
type: bug
issues:
- 111433
6 changes: 6 additions & 0 deletions docs/changelog/115308.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 115308
summary: "ESQL: Disable pushdown of WHERE past STATS"
area: ES|QL
type: bug
issues:
- 115281
5 changes: 5 additions & 0 deletions docs/changelog/115317.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 115317
summary: Revert "Add `ResolvedExpression` wrapper"
area: Indices APIs
type: bug
issues: []
6 changes: 6 additions & 0 deletions docs/changelog/115359.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 115359
summary: Adding support for simulate ingest mapping adddition for indices with mappings
that do not come from templates
area: Ingest Node
type: enhancement
issues: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions docs/reference/watcher/how-watcher-works.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,18 @@ add, the more distributed the watches can be executed. If you add or remove
replicas, all watches need to be reloaded. If a shard is relocated, the
primary and all replicas of this particular shard will reload.

Because the watches are executed on the node, where the watch shards are, you can create
dedicated watcher nodes by using shard allocation filtering.
Because the watches are executed on the node, where the watch shards are, you
can create dedicated watcher nodes by using shard allocation filtering. To do this
, configure nodes with a dedicated `node.attr.role: watcher` property.

You could configure nodes with a dedicated `node.attr.role: watcher` property and
then configure the `.watches` index like this:
As the `.watches` index is a system index, you can't use the normal `.watcher/_settings`
endpoint to modify its routing allocation. Instead, you can use the following dedicated
endpoint to adjust the allocation of the `.watches` shards to the nodes with the
`watcher` role attribute:

[source,console]
------------------------
PUT .watches/_settings
PUT _watcher/settings
{
"index.routing.allocation.include.role": "watcher"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.RemoteTransportException;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;

import static org.elasticsearch.ingest.geoip.GeoIpDownloader.DATABASES_INDEX;
import static org.elasticsearch.ingest.geoip.GeoIpDownloader.GEOIP_DOWNLOADER;
Expand Down Expand Up @@ -238,14 +239,11 @@ public void clusterChanged(ClusterChangedEvent event) {
}

static boolean hasAtLeastOneGeoipProcessor(ClusterState clusterState) {
if (pipelineConfigurationsWithGeoIpProcessor(clusterState, true).isEmpty() == false) {
if (pipelinesWithGeoIpProcessor(clusterState, true).isEmpty() == false) {
return true;
}

Set<String> checkReferencedPipelines = pipelineConfigurationsWithGeoIpProcessor(clusterState, false).stream()
.map(PipelineConfiguration::getId)
.collect(Collectors.toSet());

final Set<String> checkReferencedPipelines = pipelinesWithGeoIpProcessor(clusterState, false);
if (checkReferencedPipelines.isEmpty()) {
return false;
}
Expand All @@ -258,22 +256,24 @@ static boolean hasAtLeastOneGeoipProcessor(ClusterState clusterState) {
}

/**
* Retrieve list of pipelines that have at least one geoip processor.
* Retrieve the set of pipeline ids that have at least one geoip processor.
* @param clusterState Cluster state.
* @param downloadDatabaseOnPipelineCreation Filter the list to include only pipeline with the download_database_on_pipeline_creation
* matching the param.
* @return A list of {@link PipelineConfiguration} matching criteria.
* @return A set of pipeline ids matching criteria.
*/
@SuppressWarnings("unchecked")
private static List<PipelineConfiguration> pipelineConfigurationsWithGeoIpProcessor(
ClusterState clusterState,
boolean downloadDatabaseOnPipelineCreation
) {
List<PipelineConfiguration> pipelineDefinitions = IngestService.getPipelines(clusterState);
return pipelineDefinitions.stream().filter(pipelineConfig -> {
List<Map<String, Object>> processors = (List<Map<String, Object>>) pipelineConfig.getConfigAsMap().get(Pipeline.PROCESSORS_KEY);
return hasAtLeastOneGeoipProcessor(processors, downloadDatabaseOnPipelineCreation);
}).toList();
private static Set<String> pipelinesWithGeoIpProcessor(ClusterState clusterState, boolean downloadDatabaseOnPipelineCreation) {
List<PipelineConfiguration> configurations = IngestService.getPipelines(clusterState);
Set<String> ids = new HashSet<>();
// note: this loop is unrolled rather than streaming-style because it's hot enough to show up in a flamegraph
for (PipelineConfiguration configuration : configurations) {
List<Map<String, Object>> processors = (List<Map<String, Object>>) configuration.getConfigAsMap().get(Pipeline.PROCESSORS_KEY);
if (hasAtLeastOneGeoipProcessor(processors, downloadDatabaseOnPipelineCreation)) {
ids.add(configuration.getId());
}
}
return Collections.unmodifiableSet(ids);
}

/**
Expand All @@ -283,7 +283,15 @@ private static List<PipelineConfiguration> pipelineConfigurationsWithGeoIpProces
* @return true if a geoip processor is found in the processor list.
*/
private static boolean hasAtLeastOneGeoipProcessor(List<Map<String, Object>> processors, boolean downloadDatabaseOnPipelineCreation) {
return processors != null && processors.stream().anyMatch(p -> hasAtLeastOneGeoipProcessor(p, downloadDatabaseOnPipelineCreation));
if (processors != null) {
// note: this loop is unrolled rather than streaming-style because it's hot enough to show up in a flamegraph
for (Map<String, Object> processor : processors) {
if (hasAtLeastOneGeoipProcessor(processor, downloadDatabaseOnPipelineCreation)) {
return true;
}
}
}
return false;
}

/**
Expand Down Expand Up @@ -317,7 +325,7 @@ private static boolean hasAtLeastOneGeoipProcessor(Map<String, Object> processor
}

/**
* Check if a processor config is has an on_failure clause containing at least a geoip processor.
* Check if a processor config has an on_failure clause containing at least a geoip processor.
* @param processor Processor config.
* @param downloadDatabaseOnPipelineCreation Should the download_database_on_pipeline_creation of the geoip processor be true or false.
* @return true if a geoip processor is found in the processor list.
Expand All @@ -327,16 +335,17 @@ private static boolean isProcessorWithOnFailureGeoIpProcessor(
Map<String, Object> processor,
boolean downloadDatabaseOnPipelineCreation
) {
return processor != null
&& processor.values()
.stream()
.anyMatch(
value -> value instanceof Map
&& hasAtLeastOneGeoipProcessor(
((Map<String, List<Map<String, Object>>>) value).get("on_failure"),
downloadDatabaseOnPipelineCreation
)
);
// note: this loop is unrolled rather than streaming-style because it's hot enough to show up in a flamegraph
for (Object value : processor.values()) {
if (value instanceof Map
&& hasAtLeastOneGeoipProcessor(
((Map<String, List<Map<String, Object>>>) value).get("on_failure"),
downloadDatabaseOnPipelineCreation
)) {
return true;
}
}
return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,7 @@ public BlockLoader blockLoader(BlockLoaderContext blContext) {
SourceValueFetcher fetcher = SourceValueFetcher.toString(blContext.sourcePaths(name()));
// MatchOnlyText never has norms, so we have to use the field names field
BlockSourceReader.LeafIteratorLookup lookup = BlockSourceReader.lookupFromFieldNames(blContext.fieldNames(), name());
var sourceMode = blContext.indexSettings().getIndexMappingSourceMode();
return new BlockSourceReader.BytesRefsBlockLoader(fetcher, lookup, sourceMode);
return new BlockSourceReader.BytesRefsBlockLoader(fetcher, lookup);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ public BlockLoader blockLoader(BlockLoaderContext blContext) {
BlockSourceReader.LeafIteratorLookup lookup = isStored() || isIndexed()
? BlockSourceReader.lookupFromFieldNames(blContext.fieldNames(), name())
: BlockSourceReader.lookupMatchingAll();
var sourceMode = blContext.indexSettings().getIndexMappingSourceMode();
return new BlockSourceReader.DoublesBlockLoader(valueFetcher, lookup, sourceMode);
return new BlockSourceReader.DoublesBlockLoader(valueFetcher, lookup);
}

@Override
Expand Down
71 changes: 21 additions & 50 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ tests:
- class: org.elasticsearch.index.store.FsDirectoryFactoryTests
method: testPreload
issue: https://github.com/elastic/elasticsearch/issues/110211
- class: org.elasticsearch.backwards.SearchWithMinCompatibleSearchNodeIT
method: testMinVersionAsNewVersion
issue: https://github.com/elastic/elasticsearch/issues/95384
- class: org.elasticsearch.backwards.SearchWithMinCompatibleSearchNodeIT
method: testCcsMinimizeRoundtripsIsFalse
issue: https://github.com/elastic/elasticsearch/issues/101974
- class: "org.elasticsearch.xpack.searchablesnapshots.FrozenSearchableSnapshotsIntegTests"
issue: "https://github.com/elastic/elasticsearch/issues/110408"
method: "testCreateAndRestorePartialSearchableSnapshot"
Expand Down Expand Up @@ -99,9 +93,6 @@ tests:
issue: https://github.com/elastic/elasticsearch/issues/112424
- class: org.elasticsearch.ingest.geoip.IngestGeoIpClientYamlTestSuiteIT
issue: https://github.com/elastic/elasticsearch/issues/111497
- class: org.elasticsearch.smoketest.SmokeTestIngestWithAllDepsClientYamlTestSuiteIT
method: test {yaml=ingest/80_ingest_simulate/Test ingest simulate with reroute and mapping validation from templates}
issue: https://github.com/elastic/elasticsearch/issues/112575
- class: org.elasticsearch.xpack.security.authc.kerberos.SimpleKdcLdapServerTests
method: testClientServiceMutualAuthentication
issue: https://github.com/elastic/elasticsearch/issues/112529
Expand Down Expand Up @@ -146,18 +137,12 @@ tests:
- class: org.elasticsearch.action.admin.cluster.node.stats.NodeStatsTests
method: testChunking
issue: https://github.com/elastic/elasticsearch/issues/113139
- class: org.elasticsearch.xpack.inference.rest.ServerSentEventsRestActionListenerTests
method: testResponse
issue: https://github.com/elastic/elasticsearch/issues/113148
- class: org.elasticsearch.packaging.test.WindowsServiceTests
method: test30StartStop
issue: https://github.com/elastic/elasticsearch/issues/113160
- class: org.elasticsearch.packaging.test.WindowsServiceTests
method: test33JavaChanged
issue: https://github.com/elastic/elasticsearch/issues/113177
- class: org.elasticsearch.xpack.inference.rest.ServerSentEventsRestActionListenerTests
method: testErrorMidStream
issue: https://github.com/elastic/elasticsearch/issues/113179
- class: org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT
method: test {categorize.Categorize SYNC}
issue: https://github.com/elastic/elasticsearch/issues/113054
Expand All @@ -170,9 +155,6 @@ tests:
- class: org.elasticsearch.packaging.test.WindowsServiceTests
method: test80JavaOptsInEnvVar
issue: https://github.com/elastic/elasticsearch/issues/113219
- class: org.elasticsearch.xpack.esql.expression.function.aggregate.AvgTests
method: "testFold {TestCase=<double> #2}"
issue: https://github.com/elastic/elasticsearch/issues/113225
- class: org.elasticsearch.packaging.test.WindowsServiceTests
method: test81JavaOptsInJvmOptions
issue: https://github.com/elastic/elasticsearch/issues/113313
Expand Down Expand Up @@ -212,8 +194,6 @@ tests:
- class: org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT
method: test {categorize.Categorize SYNC}
issue: https://github.com/elastic/elasticsearch/issues/113722
- class: org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToDateNanosTests
issue: https://github.com/elastic/elasticsearch/issues/113661
- class: org.elasticsearch.ingest.geoip.DatabaseNodeServiceIT
method: testNonGzippedDatabase
issue: https://github.com/elastic/elasticsearch/issues/113821
Expand Down Expand Up @@ -244,9 +224,6 @@ tests:
- class: org.elasticsearch.xpack.inference.InferenceCrudIT
method: testGet
issue: https://github.com/elastic/elasticsearch/issues/114135
- class: org.elasticsearch.xpack.esql.expression.function.aggregate.AvgTests
method: "testFold {TestCase=<double> #7}"
issue: https://github.com/elastic/elasticsearch/issues/114175
- class: org.elasticsearch.xpack.ilm.ExplainLifecycleIT
method: testStepInfoPreservedOnAutoRetry
issue: https://github.com/elastic/elasticsearch/issues/114220
Expand All @@ -265,9 +242,6 @@ tests:
- class: org.elasticsearch.xpack.inference.InferenceRestIT
method: test {p0=inference/40_semantic_text_query/Query a field that uses the default ELSER 2 endpoint}
issue: https://github.com/elastic/elasticsearch/issues/114376
- class: org.elasticsearch.search.retriever.RankDocsRetrieverBuilderTests
method: testRewrite
issue: https://github.com/elastic/elasticsearch/issues/114467
- class: org.elasticsearch.packaging.test.DockerTests
method: test022InstallPluginsFromLocalArchive
issue: https://github.com/elastic/elasticsearch/issues/111063
Expand All @@ -276,15 +250,6 @@ tests:
- class: org.elasticsearch.xpack.inference.DefaultElserIT
method: testInferCreatesDefaultElser
issue: https://github.com/elastic/elasticsearch/issues/114503
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=synonyms/60_synonym_rule_get/Synonym set not found}
issue: https://github.com/elastic/elasticsearch/issues/114432
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=synonyms/60_synonym_rule_get/Get a synonym rule}
issue: https://github.com/elastic/elasticsearch/issues/114443
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=synonyms/60_synonym_rule_get/Synonym rule not found}
issue: https://github.com/elastic/elasticsearch/issues/114444
- class: org.elasticsearch.xpack.inference.integration.ModelRegistryIT
method: testGetModel
issue: https://github.com/elastic/elasticsearch/issues/114657
Expand All @@ -308,24 +273,30 @@ tests:
- class: org.elasticsearch.xpack.inference.DefaultEndPointsIT
method: testInferDeploysDefaultElser
issue: https://github.com/elastic/elasticsearch/issues/114913
- class: org.elasticsearch.upgrades.MultiVersionRepositoryAccessIT
method: testCreateAndRestoreSnapshot
issue: https://github.com/elastic/elasticsearch/issues/114998
- class: org.elasticsearch.index.mapper.TextFieldMapperTests
method: testBlockLoaderFromRowStrideReaderWithSyntheticSource
issue: https://github.com/elastic/elasticsearch/issues/115066
- class: org.elasticsearch.index.mapper.TextFieldMapperTests
method: testBlockLoaderFromColumnReaderWithSyntheticSource
issue: https://github.com/elastic/elasticsearch/issues/115073
- class: org.elasticsearch.index.mapper.annotatedtext.AnnotatedTextFieldMapperTests
method: testBlockLoaderFromColumnReaderWithSyntheticSource
issue: https://github.com/elastic/elasticsearch/issues/115074
- class: org.elasticsearch.index.mapper.annotatedtext.AnnotatedTextFieldMapperTests
method: testBlockLoaderFromRowStrideReaderWithSyntheticSource
issue: https://github.com/elastic/elasticsearch/issues/115076
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
method: test {p0=esql/60_usage/Basic ESQL usage output (telemetry)}
issue: https://github.com/elastic/elasticsearch/issues/115231
- class: org.elasticsearch.xpack.watcher.trigger.schedule.engine.TickerScheduleEngineTests
method: testAddWithNoLastCheckedTimeButHasActivationTimeExecutesBeforeInitialInterval
issue: https://github.com/elastic/elasticsearch/issues/115339
- class: org.elasticsearch.xpack.watcher.trigger.schedule.engine.TickerScheduleEngineTests
method: testWatchWithLastCheckedTimeExecutesBeforeInitialInterval
issue: https://github.com/elastic/elasticsearch/issues/115354
- class: org.elasticsearch.xpack.watcher.trigger.schedule.engine.TickerScheduleEngineTests
method: testAddWithLastCheckedTimeExecutesBeforeInitialInterval
issue: https://github.com/elastic/elasticsearch/issues/115356
- class: org.elasticsearch.xpack.inference.DefaultEndPointsIT
method: testInferDeploysDefaultE5
issue: https://github.com/elastic/elasticsearch/issues/115361
- class: org.elasticsearch.xpack.watcher.trigger.schedule.engine.TickerScheduleEngineTests
method: testWatchWithNoLastCheckedTimeButHasActivationTimeExecutesBeforeInitialInterval
issue: https://github.com/elastic/elasticsearch/issues/115368
- class: org.elasticsearch.reservedstate.service.FileSettingsServiceTests
method: testProcessFileChanges
issue: https://github.com/elastic/elasticsearch/issues/115280
- class: org.elasticsearch.smoketest.SmokeTestIngestWithAllDepsClientYamlTestSuiteIT
method: test {yaml=ingest/80_ingest_simulate/Test mapping addition works with legacy templates}
issue: https://github.com/elastic/elasticsearch/issues/115412

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.core.Booleans;
import org.elasticsearch.core.CheckedFunction;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
Expand Down Expand Up @@ -1203,15 +1202,8 @@ public void testClosedIndices() throws Exception {
closeIndex(index);
}

@UpdateForV9(owner = UpdateForV9.Owner.DISTRIBUTED_INDEXING) // This check can be removed (always assume true)
var originalClusterSupportsReplicationOfClosedIndices = oldClusterHasFeature(RestTestLegacyFeatures.REPLICATION_OF_CLOSED_INDICES);

if (originalClusterSupportsReplicationOfClosedIndices) {
ensureGreenLongWait(index);
assertClosedIndex(index, true);
} else {
assertClosedIndex(index, false);
}
ensureGreenLongWait(index);
assertClosedIndex(index, true);

if (isRunningAgainstOldCluster() == false) {
openIndex(index);
Expand Down
Loading

0 comments on commit c198397

Please sign in to comment.