Skip to content

Commit cabaccf

Browse files
authored
Merge branch 'main' into fix/bulk-pipeline
2 parents 0207eb7 + 2b92a4a commit cabaccf

File tree

22 files changed

+669
-38
lines changed

22 files changed

+669
-38
lines changed

build-tools-internal/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=16f2b95838c1ddcf7242b1c39e7bbbb43c842f1f1a1a0dc4959b6d4d68abcac3
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip
3+
distributionSha256Sum=f86344275d1b194688dd330abf9f6f2344cd02872ffee035f2d1ea2fd60cf7f3
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9.2.0
1+
9.2.1

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=16f2b95838c1ddcf7242b1c39e7bbbb43c842f1f1a1a0dc4959b6d4d68abcac3
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip
3+
distributionSha256Sum=f86344275d1b194688dd330abf9f6f2344cd02872ffee035f2d1ea2fd60cf7f3
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

libs/ssl-config/src/main/java/org/elasticsearch/common/ssl/DerParser.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ private int getLength() throws IOException {
138138
int n = derInputStream.read(bytes);
139139
if (n < num) throw new IOException("Invalid DER: length too short");
140140

141-
return new BigInteger(1, bytes).intValue();
141+
int len = new BigInteger(1, bytes).intValue();
142+
if (len < 0) {
143+
throw new IOException("Invalid DER: length larger than max-int");
144+
}
145+
146+
return len;
142147
}
143148

144149
/**

muted-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ tests:
6060
- class: org.elasticsearch.xpack.ccr.FollowIndexSecurityIT
6161
method: testCleanShardFollowTaskAfterDeleteFollower
6262
issue: https://github.com/elastic/elasticsearch/issues/120339
63-
- class: org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeToCharProcessorTests
64-
issue: https://github.com/elastic/elasticsearch/issues/120575
6563
- class: org.elasticsearch.xpack.security.authc.service.ServiceAccountIT
6664
method: testAuthenticateShouldNotFallThroughInCaseOfFailure
6765
issue: https://github.com/elastic/elasticsearch/issues/120902

plugins/examples/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=16f2b95838c1ddcf7242b1c39e7bbbb43c842f1f1a1a0dc4959b6d4d68abcac3
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip
3+
distributionSha256Sum=f86344275d1b194688dd330abf9f6f2344cd02872ffee035f2d1ea2fd60cf7f3
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

server/src/main/java/org/elasticsearch/cluster/ClusterModule.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider;
5959
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
6060
import org.elasticsearch.cluster.routing.allocation.decider.FilterAllocationDecider;
61+
import org.elasticsearch.cluster.routing.allocation.decider.IndexBalanceAllocationDecider;
6162
import org.elasticsearch.cluster.routing.allocation.decider.IndexVersionAllocationDecider;
6263
import org.elasticsearch.cluster.routing.allocation.decider.MaxRetryAllocationDecider;
6364
import org.elasticsearch.cluster.routing.allocation.decider.NodeReplacementAllocationDecider;
@@ -497,6 +498,7 @@ public static Collection<AllocationDecider> createAllocationDeciders(
497498
addAllocationDecider(deciders, new ThrottlingAllocationDecider(clusterSettings));
498499
addAllocationDecider(deciders, new ShardsLimitAllocationDecider(clusterSettings));
499500
addAllocationDecider(deciders, new AwarenessAllocationDecider(settings, clusterSettings));
501+
addAllocationDecider(deciders, new IndexBalanceAllocationDecider(settings, clusterSettings));
500502

501503
clusterPlugins.stream()
502504
.flatMap(p -> p.createAllocationDeciders(settings, clusterSettings).stream())

server/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodeFilters.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,10 @@ private boolean isSingleNodeFilterInternal() {
250250
|| (filters.size() > 1 && opType == OpType.AND && NON_ATTRIBUTE_NAMES.containsAll(filters.keySet()));
251251
}
252252

253+
public boolean hasFilters() {
254+
return filters.isEmpty() == false;
255+
}
256+
253257
/**
254258
* Generates a human-readable string for the DiscoverNodeFilters.
255259
* Example: {@code _id:"id1 OR blah",name:"blah OR name2"}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.cluster.routing.allocation;
11+
12+
import org.elasticsearch.common.settings.ClusterSettings;
13+
import org.elasticsearch.common.settings.Setting;
14+
15+
/**
16+
* Settings definitions for the index shard count allocation decider and associated infrastructure
17+
*/
18+
public class IndexBalanceConstraintSettings {
19+
20+
private static final String SETTING_PREFIX = "cluster.routing.allocation.index_balance_decider.";
21+
22+
public static final Setting<Boolean> INDEX_BALANCE_DECIDER_ENABLED_SETTING = Setting.boolSetting(
23+
SETTING_PREFIX + "enabled",
24+
false,
25+
Setting.Property.Dynamic,
26+
Setting.Property.NodeScope
27+
);
28+
29+
/**
30+
* This setting permits nodes to host more than ideally balanced number of index shards.
31+
* Maximum tolerated index shard count = ideal + skew_tolerance
32+
* i.e. ideal = 4 shards, skew_tolerance = 1
33+
* maximum tolerated index shards = 4 + 1 = 5.
34+
*/
35+
public static final Setting<Integer> INDEX_BALANCE_DECIDER_EXCESS_SHARDS = Setting.intSetting(
36+
SETTING_PREFIX + "excess_shards",
37+
0,
38+
0,
39+
Setting.Property.Dynamic,
40+
Setting.Property.NodeScope
41+
);
42+
43+
private volatile boolean deciderEnabled;
44+
private volatile int excessShards;
45+
46+
public IndexBalanceConstraintSettings(ClusterSettings clusterSettings) {
47+
clusterSettings.initializeAndWatch(INDEX_BALANCE_DECIDER_ENABLED_SETTING, enabled -> this.deciderEnabled = enabled);
48+
clusterSettings.initializeAndWatch(INDEX_BALANCE_DECIDER_EXCESS_SHARDS, value -> this.excessShards = value);
49+
}
50+
51+
public boolean isDeciderEnabled() {
52+
return this.deciderEnabled;
53+
}
54+
55+
public int getExcessShards() {
56+
return this.excessShards;
57+
}
58+
59+
}

server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,11 @@ private boolean tryRelocateShard(ModelNode minNode, ModelNode maxNode, ProjectIn
15811581
logger.trace("No shards of [{}] can relocate from [{}] to [{}]", idx, maxNode.getNodeId(), minNode.getNodeId());
15821582
return false;
15831583
}
1584+
1585+
// Visible for testing.
1586+
public RoutingAllocation getAllocation() {
1587+
return this.allocation;
1588+
}
15841589
}
15851590

15861591
public static class ModelNode implements Iterable<ModelIndex> {
@@ -1824,7 +1829,8 @@ public WeightFunction getWeightFunction() {
18241829
}
18251830
}
18261831

1827-
record ProjectIndex(ProjectId project, String indexName) {
1832+
// Visible for testing.
1833+
public record ProjectIndex(ProjectId project, String indexName) {
18281834
ProjectIndex(RoutingAllocation allocation, ShardRouting shard) {
18291835
this(allocation.metadata().projectFor(shard.index()).id(), shard.getIndexName());
18301836
}

0 commit comments

Comments
 (0)