Skip to content

Commit c0f8c92

Browse files
author
elasticsearchmachine
committed
Merge remote-tracking branch 'origin/main' into lucene_snapshot
2 parents 73bbe0a + 06aa32b commit c0f8c92

File tree

11 files changed

+143
-42
lines changed

11 files changed

+143
-42
lines changed

docs/changelog/112400.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 112400
2+
summary: Make sure file accesses in `DnRoleMapper` are done in stack frames with permissions
3+
area: Infra/Core
4+
type: bug
5+
issues: []

docs/reference/setup/install/docker/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ services:
117117
- cluster.name=${CLUSTER_NAME}
118118
- cluster.initial_master_nodes=es01,es02,es03
119119
- discovery.seed_hosts=es01,es03
120+
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
120121
- bootstrap.memory_lock=true
121122
- xpack.security.enabled=true
122123
- xpack.security.http.ssl.enabled=true
@@ -156,6 +157,7 @@ services:
156157
- cluster.name=${CLUSTER_NAME}
157158
- cluster.initial_master_nodes=es01,es02,es03
158159
- discovery.seed_hosts=es01,es02
160+
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
159161
- bootstrap.memory_lock=true
160162
- xpack.security.enabled=true
161163
- xpack.security.http.ssl.enabled=true

modules/data-streams/src/main/java/org/elasticsearch/datastreams/rest/RestGetDataStreamsAction.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public Set<String> supportedQueryParameters() {
6666
"include_defaults",
6767
"timeout",
6868
"master_timeout",
69+
RestRequest.PATH_RESTRICTED,
6970
IndicesOptions.WildcardOptions.EXPAND_WILDCARDS,
7071
IndicesOptions.ConcreteTargetOptions.IGNORE_UNAVAILABLE,
7172
IndicesOptions.WildcardOptions.ALLOW_NO_INDICES,

muted-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ tests:
176176
issue: https://github.com/elastic/elasticsearch/issues/112421
177177
- class: org.elasticsearch.indices.mapping.UpdateMappingIntegrationIT
178178
issue: https://github.com/elastic/elasticsearch/issues/112423
179+
- class: org.elasticsearch.xpack.spatial.index.query.LegacyGeoShapeWithDocValuesQueryTests
180+
method: testIndexPointsFromLine
181+
issue: https://github.com/elastic/elasticsearch/issues/112438
179182

180183
# Examples:
181184
#

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ public class DesiredBalanceReconciler {
8989
private final DoubleGauge undesiredAllocationsRatio;
9090

9191
public DesiredBalanceReconciler(ClusterSettings clusterSettings, ThreadPool threadPool, MeterRegistry meterRegistry) {
92-
this.undesiredAllocationLogInterval = new FrequencyCappedAction(threadPool);
92+
this.undesiredAllocationLogInterval = new FrequencyCappedAction(
93+
threadPool.relativeTimeInMillisSupplier(),
94+
TimeValue.timeValueMinutes(5)
95+
);
9396
clusterSettings.initializeAndWatch(UNDESIRED_ALLOCATIONS_LOG_INTERVAL_SETTING, this.undesiredAllocationLogInterval::setMinInterval);
9497
clusterSettings.initializeAndWatch(
9598
UNDESIRED_ALLOCATIONS_LOG_THRESHOLD_SETTING,

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
package org.elasticsearch.cluster.routing.allocation.allocator;
1010

1111
import org.elasticsearch.core.TimeValue;
12-
import org.elasticsearch.threadpool.ThreadPool;
1312

1413
import java.util.function.LongSupplier;
1514

@@ -21,15 +20,12 @@ public class FrequencyCappedAction {
2120
private final LongSupplier currentTimeMillisSupplier;
2221
private TimeValue minInterval;
2322

24-
private long next = -1;
23+
private long next;
2524

26-
public FrequencyCappedAction(ThreadPool threadPool) {
27-
this(threadPool.relativeTimeInMillisSupplier());
28-
}
29-
30-
public FrequencyCappedAction(LongSupplier currentTimeMillisSupplier) {
25+
public FrequencyCappedAction(LongSupplier currentTimeMillisSupplier, TimeValue initialDelay) {
3126
this.currentTimeMillisSupplier = currentTimeMillisSupplier;
3227
this.minInterval = TimeValue.MAX_VALUE;
28+
this.next = currentTimeMillisSupplier.getAsLong() + initialDelay.getMillis();
3329
}
3430

3531
public void setMinInterval(TimeValue minInterval) {

server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/DesiredBalanceReconcilerTests.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import org.elasticsearch.common.settings.Settings;
5656
import org.elasticsearch.common.util.Maps;
5757
import org.elasticsearch.common.util.concurrent.DeterministicTaskQueue;
58+
import org.elasticsearch.core.TimeValue;
5859
import org.elasticsearch.gateway.GatewayAllocator;
5960
import org.elasticsearch.index.IndexVersion;
6061
import org.elasticsearch.index.shard.ShardId;
@@ -1281,9 +1282,12 @@ public void testShouldLogOnTooManyUndesiredAllocations() {
12811282
.build();
12821283

12831284
var threadPool = mock(ThreadPool.class);
1284-
when(threadPool.relativeTimeInMillisSupplier()).thenReturn(new AtomicLong()::incrementAndGet);
1285+
final var timeInMillisSupplier = new AtomicLong();
1286+
when(threadPool.relativeTimeInMillisSupplier()).thenReturn(timeInMillisSupplier::incrementAndGet);
12851287

12861288
var reconciler = new DesiredBalanceReconciler(createBuiltInClusterSettings(), threadPool, mock(MeterRegistry.class));
1289+
final long initialDelayInMillis = TimeValue.timeValueMinutes(5).getMillis();
1290+
timeInMillisSupplier.addAndGet(randomLongBetween(initialDelayInMillis, 2 * initialDelayInMillis));
12871291

12881292
var expectedWarningMessage = "[100%] of assigned shards ("
12891293
+ shardCount
@@ -1323,7 +1327,9 @@ public void testShouldLogOnTooManyUndesiredAllocations() {
13231327
}
13241328

13251329
private static void reconcile(RoutingAllocation routingAllocation, DesiredBalance desiredBalance) {
1326-
new DesiredBalanceReconciler(createBuiltInClusterSettings(), mock(ThreadPool.class), mock(MeterRegistry.class)).reconcile(
1330+
final var threadPool = mock(ThreadPool.class);
1331+
when(threadPool.relativeTimeInMillisSupplier()).thenReturn(new AtomicLong()::incrementAndGet);
1332+
new DesiredBalanceReconciler(createBuiltInClusterSettings(), threadPool, mock(MeterRegistry.class)).reconcile(
13271333
desiredBalance,
13281334
routingAllocation
13291335
);

server/src/test/java/org/elasticsearch/cluster/routing/allocation/allocator/FrequencyCappedActionTests.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package org.elasticsearch.cluster.routing.allocation.allocator;
1010

11+
import org.elasticsearch.core.TimeValue;
1112
import org.elasticsearch.test.ESTestCase;
1213

1314
import java.util.concurrent.atomic.AtomicLong;
@@ -21,22 +22,29 @@ public void testFrequencyCapExecution() {
2122

2223
var executions = new AtomicLong(0);
2324
var currentTime = new AtomicLong();
24-
var action = new FrequencyCappedAction(currentTime::get);
25+
final TimeValue initialDelay = randomBoolean() ? TimeValue.ZERO : TimeValue.timeValueSeconds(between(1, 300));
26+
var action = new FrequencyCappedAction(currentTime::get, initialDelay);
2527

2628
var minInterval = timeValueMillis(randomNonNegativeInt());
2729
action.setMinInterval(minInterval);
2830

29-
// initial execution should happen
3031
action.maybeExecute(executions::incrementAndGet);
32+
if (initialDelay != TimeValue.ZERO) {
33+
// Not executing due to initial delay
34+
assertThat(executions.get(), equalTo(0L));
35+
currentTime.addAndGet(randomLongBetween(initialDelay.millis(), initialDelay.millis() * 2));
36+
action.maybeExecute(executions::incrementAndGet);
37+
}
38+
// initial execution should happen
3139
assertThat(executions.get(), equalTo(1L));
3240

3341
// should not execute again too soon
34-
currentTime.set(randomLongBetween(0, minInterval.millis() - 1));
42+
currentTime.addAndGet(randomLongBetween(0, minInterval.millis() - 1));
3543
action.maybeExecute(executions::incrementAndGet);
3644
assertThat(executions.get(), equalTo(1L));
3745

3846
// should execute min interval elapsed
39-
currentTime.set(randomLongBetween(minInterval.millis(), Long.MAX_VALUE));
47+
currentTime.addAndGet(randomLongBetween(minInterval.millis(), Long.MAX_VALUE));
4048
action.maybeExecute(executions::incrementAndGet);
4149
assertThat(executions.get(), equalTo(2L));
4250
}

0 commit comments

Comments
 (0)