Skip to content

Commit 6ff2231

Browse files
authored
Merge branch 'main' into feature/prevent-create-api-with-cloud-api-key
2 parents b2ead37 + 5be4100 commit 6ff2231

File tree

20 files changed

+664
-168
lines changed

20 files changed

+664
-168
lines changed

docs/changelog/122497.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122497
2+
summary: Check if index patterns conform to valid format before validation
3+
area: CCS
4+
type: enhancement
5+
issues: []

docs/changelog/129370.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pr: 129370
2+
summary: Avoid dropping aggregate groupings in local plans
3+
area: ES|QL
4+
type: bug
5+
issues:
6+
- 129811
7+
- 128054

docs/changelog/130032.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
pr: 130032
2+
summary: ES|QL cross-cluster querying is now generally available
3+
area: ES|QL
4+
type: feature
5+
issues: []
6+
highlight:
7+
title: ES|QL cross-cluster querying is now generally available
8+
body: |-
9+
The ES|QL Cross-Cluster querying feature has been in technical preview since 8.13.
10+
As of releases 8.19.0 and 9.1.0 this is now generally available.
11+
This feature allows you to run ES|QL queries across multiple clusters.
12+
notable: true

docs/reference/elasticsearch/index-settings/slow-log.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ navigation_title: Slow log
88

99
The slow log records database searching and indexing events that have execution durations above specified thresholds. You can use these logs to investigate analyze or troubleshoot your cluster’s historical search and indexing performance.
1010

11-
Slow logs report task duration at the shard level for searches, and at the index level for indexing, but might not encompass the full task execution time observed on the client. For example, slow logs don’t surface HTTP network delays or the impact of [task queues](docs-content://troubleshoot/elasticsearch/task-queue-backlog.md).
11+
Slow logs report task duration at the shard level for searches, and at the index level for indexing, but might not encompass the full task execution time observed on the client. For example, slow logs don’t surface HTTP network delays or the impact of [task queues](docs-content://troubleshoot/elasticsearch/task-queue-backlog.md). For more information about the higher-level operations affecting response times, refer to [Reading and writing documents](docs-content://deploy-manage/distributed-architecture/reading-and-writing-documents.md).
1212

1313
Events that meet the specified threshold are emitted into [{{es}} logging](docs-content://deploy-manage/monitor/logging-configuration/update-elasticsearch-logging-levels.md) under the `fileset.name` of `slowlog`. These logs can be viewed in the following locations:
1414

modules/ingest-geoip/qa/multi-project/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ dependencies {
2222
tasks.withType(Test).configureEach {
2323
it.systemProperty "tests.multi_project.enabled", true
2424
}
25+
26+
// Exclude multi-project tests from release build
27+
tasks.named { it == "javaRestTest" || it == "yamlRestTest" }.configureEach {
28+
it.onlyIf("snapshot build") { buildParams.snapshotBuild }
29+
}

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,6 @@ tests:
476476
- class: org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceDiskSpaceTests
477477
method: testAvailableDiskSpaceMonitorWhenFileSystemStatErrors
478478
issue: https://github.com/elastic/elasticsearch/issues/129149
479-
- class: org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceDiskSpaceTests
480-
method: testUnavailableBudgetBlocksNewMergeTasksFromStartingExecution
481-
issue: https://github.com/elastic/elasticsearch/issues/129148
482479
- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeForkIT
483480
method: test {lookup-join.EnrichLookupStatsBug ASYNC}
484481
issue: https://github.com/elastic/elasticsearch/issues/129228

server/src/test/java/org/elasticsearch/index/engine/ThreadPoolMergeExecutorServiceDiskSpaceTests.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ public void testUnavailableBudgetBlocksNewMergeTasksFromStartingExecution() thro
847847
when(mergeTask2.schedule()).thenReturn(RUN);
848848
boolean task1Runs = randomBoolean();
849849
long currentAvailableBudget = expectedAvailableBudget.get();
850+
// the over-budget here can be larger than the total initial available budget
850851
long overBudget = randomLongBetween(currentAvailableBudget + 1L, currentAvailableBudget + 100L);
851852
long underBudget = randomLongBetween(0L, currentAvailableBudget);
852853
if (task1Runs) {
@@ -882,11 +883,18 @@ public void testUnavailableBudgetBlocksNewMergeTasksFromStartingExecution() thro
882883
// update the expected budget given that one task now finished
883884
expectedAvailableBudget.set(expectedAvailableBudget.get() + completedMergeTask.estimatedRemainingMergeSize());
884885
}
885-
// let the test finish cleanly
886-
assertBusy(() -> {
887-
assertThat(threadPoolMergeExecutorService.getDiskSpaceAvailableForNewMergeTasks(), is(aHasMoreSpace ? 112_500L : 103_000L));
888-
assertThat(threadPoolMergeExecutorService.allDone(), is(true));
889-
});
886+
assertBusy(
887+
() -> assertThat(
888+
threadPoolMergeExecutorService.getDiskSpaceAvailableForNewMergeTasks(),
889+
is(aHasMoreSpace ? 112_500L : 103_000L)
890+
)
891+
);
892+
// let the test finish cleanly (some tasks can be over budget even if all the other tasks finished running)
893+
aFileStore.totalSpace = Long.MAX_VALUE;
894+
bFileStore.totalSpace = Long.MAX_VALUE;
895+
aFileStore.usableSpace = Long.MAX_VALUE;
896+
bFileStore.usableSpace = Long.MAX_VALUE;
897+
assertBusy(() -> assertThat(threadPoolMergeExecutorService.allDone(), is(true)));
890898
}
891899
if (setThreadPoolMergeSchedulerSetting) {
892900
assertWarnings(

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/EsqlActionIT.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,6 +1679,39 @@ public void testQueryOnEmptyDataIndex() {
16791679
}
16801680
}
16811681

1682+
public void testGroupingStatsOnMissingFields() {
1683+
assertAcked(client().admin().indices().prepareCreate("missing_field_index").setMapping("data", "type=long"));
1684+
long oneValue = between(1, 1000);
1685+
indexDoc("missing_field_index", "1", "data", oneValue);
1686+
refresh("missing_field_index");
1687+
QueryPragmas pragmas = randomPragmas();
1688+
pragmas = new QueryPragmas(
1689+
Settings.builder().put(pragmas.getSettings()).put(QueryPragmas.MAX_CONCURRENT_SHARDS_PER_NODE.getKey(), 1).build()
1690+
);
1691+
EsqlQueryRequest request = new EsqlQueryRequest();
1692+
request.query("FROM missing_field_index,test | STATS s = sum(data) BY color, tag | SORT color");
1693+
request.pragmas(pragmas);
1694+
try (var r = run(request)) {
1695+
var rows = getValuesList(r);
1696+
assertThat(rows, hasSize(4));
1697+
for (List<Object> row : rows) {
1698+
assertThat(row, hasSize(3));
1699+
}
1700+
assertThat(rows.get(0).get(0), equalTo(20L));
1701+
assertThat(rows.get(0).get(1), equalTo("blue"));
1702+
assertNull(rows.get(0).get(2));
1703+
assertThat(rows.get(1).get(0), equalTo(10L));
1704+
assertThat(rows.get(1).get(1), equalTo("green"));
1705+
assertNull(rows.get(1).get(2));
1706+
assertThat(rows.get(2).get(0), equalTo(30L));
1707+
assertThat(rows.get(2).get(1), equalTo("red"));
1708+
assertNull(rows.get(2).get(2));
1709+
assertThat(rows.get(3).get(0), equalTo(oneValue));
1710+
assertNull(rows.get(3).get(1));
1711+
assertNull(rows.get(3).get(2));
1712+
}
1713+
}
1714+
16821715
private void assertEmptyIndexQueries(String from) {
16831716
try (EsqlQueryResponse resp = run(from + "METADATA _source | KEEP _source | LIMIT 1")) {
16841717
assertFalse(resp.values().hasNext());
@@ -1816,6 +1849,8 @@ private void createAndPopulateIndex(String indexName, Settings additionalSetting
18161849
"time",
18171850
"type=long",
18181851
"color",
1852+
"type=keyword",
1853+
"tag",
18191854
"type=keyword"
18201855
)
18211856
);

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/LocalLogicalPlanOptimizer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
* This class is part of the planner. Data node level logical optimizations. At this point we have access to
3131
* {@link org.elasticsearch.xpack.esql.stats.SearchStats} which provides access to metadata about the index.
3232
*
33-
* <p>NB: This class also reapplies all the rules from {@link LogicalPlanOptimizer#operators()} and {@link LogicalPlanOptimizer#cleanup()}
33+
* <p>NB: This class also reapplies all the rules from {@link LogicalPlanOptimizer#operators(boolean)}
34+
* and {@link LogicalPlanOptimizer#cleanup()}
3435
*/
3536
public class LocalLogicalPlanOptimizer extends ParameterizedRuleExecutor<LogicalPlan, LocalLogicalOptimizerContext> {
3637

@@ -58,8 +59,8 @@ protected List<Batch<LogicalPlan>> batches() {
5859

5960
@SuppressWarnings("unchecked")
6061
private static Batch<LogicalPlan> localOperators() {
61-
var operators = operators();
62-
var rules = operators().rules();
62+
var operators = operators(true);
63+
var rules = operators.rules();
6364
List<Rule<?, LogicalPlan>> newRules = new ArrayList<>(rules.length);
6465

6566
// apply updates to existing rules that have different applicability locally

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,22 @@
8282
* <li>The {@link LogicalPlanOptimizer#substitutions()} phase rewrites things to expand out shorthand in the syntax. For example,
8383
* a nested expression embedded in a stats gets replaced with an eval followed by a stats, followed by another eval. This phase
8484
* also applies surrogates, such as replacing an average with a sum divided by a count.</li>
85-
* <li>{@link LogicalPlanOptimizer#operators()} (NB: The word "operator" is extremely overloaded and referrers to many different
85+
* <li>{@link LogicalPlanOptimizer#operators(boolean)} (NB: The word "operator" is extremely overloaded and referrers to many different
8686
* things.) transform the tree in various different ways. This includes folding (i.e. computing constant expressions at parse
8787
* time), combining expressions, dropping redundant clauses, and some normalization such as putting literals on the right whenever
8888
* possible. These rules are run in a loop until none of the rules make any changes to the plan (there is also a safety shut off
8989
* after many iterations, although hitting that is considered a bug)</li>
9090
* <li>{@link LogicalPlanOptimizer#cleanup()} Which can replace sorts+limit with a TopN</li>
9191
* </ul>
9292
*
93-
* <p>Note that the {@link LogicalPlanOptimizer#operators()} and {@link LogicalPlanOptimizer#cleanup()} steps are reapplied at the
93+
* <p>Note that the {@link LogicalPlanOptimizer#operators(boolean)} and {@link LogicalPlanOptimizer#cleanup()} steps are reapplied at the
9494
* {@link LocalLogicalPlanOptimizer} layer.</p>
9595
*/
9696
public class LogicalPlanOptimizer extends ParameterizedRuleExecutor<LogicalPlan, LogicalOptimizerContext> {
9797

9898
private static final List<RuleExecutor.Batch<LogicalPlan>> RULES = List.of(
9999
substitutions(),
100-
operators(),
100+
operators(false),
101101
new Batch<>("Skip Compute", new SkipQueryOnLimitZero()),
102102
cleanup(),
103103
new Batch<>("Set as Optimized", Limiter.ONCE, new SetAsOptimized())
@@ -160,10 +160,10 @@ protected static Batch<LogicalPlan> substitutions() {
160160
);
161161
}
162162

163-
protected static Batch<LogicalPlan> operators() {
163+
protected static Batch<LogicalPlan> operators(boolean local) {
164164
return new Batch<>(
165165
"Operator Optimization",
166-
new CombineProjections(),
166+
new CombineProjections(local),
167167
new CombineEvals(),
168168
new PruneEmptyPlans(),
169169
new PropagateEmptyRelation(),

0 commit comments

Comments
 (0)