Skip to content

Commit 6c5848a

Browse files
author
elasticsearchmachine
committed
Merge remote-tracking branch 'origin/main' into lucene_snapshot
2 parents 5463124 + 23e7fe9 commit 6c5848a

File tree

14 files changed

+853
-253
lines changed

14 files changed

+853
-253
lines changed

modules/repository-gcs/src/main/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobContainer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,11 @@ public void compareAndExchangeRegister(
145145
BytesReference updated,
146146
ActionListener<OptionalBytesReference> listener
147147
) {
148-
if (skipCas(listener)) return;
149148
ActionListener.completeWith(listener, () -> blobStore.compareAndExchangeRegister(buildKey(key), path, key, expected, updated));
150149
}
151150

152151
@Override
153152
public void getRegister(OperationPurpose purpose, String key, ActionListener<OptionalBytesReference> listener) {
154-
if (skipCas(listener)) return;
155153
ActionListener.completeWith(listener, () -> blobStore.getRegister(buildKey(key), path, key));
156154
}
157155
}

modules/repository-gcs/src/test/java/org/elasticsearch/repositories/gcs/GoogleCloudStorageBlobContainerRetriesTests.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
import java.util.concurrent.atomic.AtomicInteger;
6060
import java.util.concurrent.atomic.AtomicReference;
6161

62-
import static fixture.gcs.GoogleCloudStorageHttpHandler.getContentRangeEnd;
63-
import static fixture.gcs.GoogleCloudStorageHttpHandler.getContentRangeLimit;
64-
import static fixture.gcs.GoogleCloudStorageHttpHandler.getContentRangeStart;
6562
import static fixture.gcs.GoogleCloudStorageHttpHandler.parseMultipartRequestBody;
6663
import static fixture.gcs.TestUtils.createServiceAccount;
6764
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -369,14 +366,14 @@ public void testWriteLargeBlob() throws IOException {
369366

370367
assertThat(Math.toIntExact(requestBody.length()), anyOf(equalTo(defaultChunkSize), equalTo(lastChunkSize)));
371368

372-
final int rangeStart = getContentRangeStart(range);
373-
final int rangeEnd = getContentRangeEnd(range);
369+
final HttpHeaderParser.ContentRange contentRange = HttpHeaderParser.parseContentRangeHeader(range);
370+
final int rangeStart = Math.toIntExact(contentRange.start());
371+
final int rangeEnd = Math.toIntExact(contentRange.end());
374372
assertThat(rangeEnd + 1 - rangeStart, equalTo(Math.toIntExact(requestBody.length())));
375373
assertThat(new BytesArray(data, rangeStart, rangeEnd - rangeStart + 1), is(requestBody));
376374
bytesReceived.updateAndGet(existing -> Math.max(existing, rangeEnd));
377375

378-
final Integer limit = getContentRangeLimit(range);
379-
if (limit != null) {
376+
if (contentRange.size() != null) {
380377
exchange.sendResponseHeaders(RestStatus.OK.getStatus(), -1);
381378
return;
382379
} else {

muted-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ tests:
279279
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
280280
method: testSearchableSnapshotUpgrade {p0=[9.0.0, 9.0.0, 9.0.0]}
281281
issue: https://github.com/elastic/elasticsearch/issues/119562
282+
- class: org.elasticsearch.xpack.ml.integration.ForecastIT
283+
method: testOverflowToDisk
284+
issue: https://github.com/elastic/elasticsearch/issues/117740
282285

283286
# Examples:
284287
#

server/src/main/java/org/elasticsearch/common/blobstore/support/AbstractBlobContainer.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
package org.elasticsearch.common.blobstore.support;
1111

12-
import org.elasticsearch.action.ActionListener;
1312
import org.elasticsearch.common.blobstore.BlobContainer;
1413
import org.elasticsearch.common.blobstore.BlobPath;
1514

@@ -24,17 +23,6 @@ protected AbstractBlobContainer(BlobPath path) {
2423
this.path = path;
2524
}
2625

27-
/**
28-
* Temporary check that permits disabling CAS operations at runtime; TODO remove this when no longer needed
29-
*/
30-
protected static boolean skipCas(ActionListener<?> listener) {
31-
if ("true".equals(System.getProperty("test.repository_test_kit.skip_cas"))) {
32-
listener.onFailure(new UnsupportedOperationException());
33-
return true;
34-
}
35-
return false;
36-
}
37-
3826
@Override
3927
public BlobPath path() {
4028
return this.path;

server/src/main/java/org/elasticsearch/search/aggregations/AggregatorsReducer.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
import org.elasticsearch.core.Releasable;
1313
import org.elasticsearch.core.Releasables;
1414

15+
import java.util.ArrayList;
16+
import java.util.Collection;
1517
import java.util.HashMap;
18+
import java.util.List;
1619
import java.util.Map;
1720

1821
/**
@@ -54,7 +57,12 @@ public void accept(InternalAggregations aggregations) {
5457
* returns the reduced {@link InternalAggregations}.
5558
*/
5659
public InternalAggregations get() {
57-
return InternalAggregations.from(aggByName.values().stream().map(AggregatorReducer::get).toList());
60+
final Collection<AggregatorReducer> reducers = aggByName.values();
61+
final List<InternalAggregation> aggs = new ArrayList<>(reducers.size());
62+
for (AggregatorReducer reducer : reducers) {
63+
aggs.add(reducer.get());
64+
}
65+
return InternalAggregations.from(aggs);
5866
}
5967

6068
@Override

0 commit comments

Comments
 (0)