Skip to content

Commit bb450da

Browse files
authored
Merge branch 'main' into 2025/04/25/S3RepositoryAnalysisRestIT-failure
2 parents 78b4fb6 + 26e2261 commit bb450da

File tree

48 files changed

+1238
-1204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1238
-1204
lines changed

docs/changelog/127259.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/MatchOnlyTextFieldMapperTests.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.lucene.tests.analysis.CannedTokenStream;
2222
import org.apache.lucene.tests.analysis.Token;
2323
import org.apache.lucene.tests.index.RandomIndexWriter;
24-
import org.apache.lucene.util.BytesRef;
2524
import org.elasticsearch.common.Strings;
2625
import org.elasticsearch.core.Tuple;
2726
import org.elasticsearch.index.mapper.DocumentMapper;
@@ -44,7 +43,6 @@
4443
import java.util.Collection;
4544
import java.util.Collections;
4645
import java.util.List;
47-
import java.util.function.Function;
4846
import java.util.stream.Collectors;
4947

5048
import static org.hamcrest.Matchers.containsString;
@@ -257,9 +255,4 @@ public void testDocValuesLoadedFromSynthetic() throws IOException {
257255
protected IngestScriptSupport ingestScriptSupport() {
258256
throw new AssumptionViolatedException("not supported");
259257
}
260-
261-
@Override
262-
protected Function<Object, Object> loadBlockExpected() {
263-
return v -> ((BytesRef) v).utf8ToString();
264-
}
265258
}

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/ScaledFloatFieldMapperTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ public SyntheticSourceExample example(int maxVals) {
377377
return new SyntheticSourceExample(
378378
example.expectedForSyntheticSource(),
379379
example.expectedForSyntheticSource(),
380-
example.expectedForBlockLoader(),
381380
example.mapping()
382381
);
383382
}
@@ -400,7 +399,7 @@ public SyntheticSourceExample example(int maxValues) {
400399
if (v.malformedOutput == null) {
401400
return new SyntheticSourceExample(v.input, v.output, this::mapping);
402401
}
403-
return new SyntheticSourceExample(v.input, v.malformedOutput, null, this::mapping);
402+
return new SyntheticSourceExample(v.input, v.malformedOutput, this::mapping);
404403
}
405404
List<Value> values = randomList(1, maxValues, this::generateValue);
406405
List<Object> in = values.stream().map(Value::input).toList();
@@ -479,11 +478,6 @@ public List<SyntheticSourceInvalidExample> invalidExample() throws IOException {
479478
}
480479
}
481480

482-
protected BlockReaderSupport getSupportedReaders(MapperService mapper, String loaderFieldName) {
483-
assumeTrue("Disabled, tested by ScaledFloatFieldBlockLoaderTests instead", false);
484-
return null;
485-
}
486-
487481
@Override
488482
protected IngestScriptSupport ingestScriptSupport() {
489483
throw new AssumptionViolatedException("not supported");

modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/extras/TokenCountFieldMapperTests.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
import java.util.Collections;
3737
import java.util.List;
3838
import java.util.Map;
39-
import java.util.Objects;
40-
import java.util.function.Function;
4139
import java.util.stream.Collectors;
4240

4341
import static org.hamcrest.Matchers.equalTo;
@@ -213,17 +211,13 @@ public boolean preservesExactSource() {
213211
public SyntheticSourceExample example(int maxValues) {
214212
if (randomBoolean()) {
215213
var value = generateValue();
216-
return new SyntheticSourceExample(value.text, value.text, value.tokenCount, this::mapping);
214+
return new SyntheticSourceExample(value.text, value.text, this::mapping);
217215
}
218216

219217
var values = randomList(1, 5, this::generateValue);
220-
221218
var textArray = values.stream().map(Value::text).toList();
222219

223-
var blockExpectedList = values.stream().map(Value::tokenCount).filter(Objects::nonNull).sorted().toList();
224-
var blockExpected = blockExpectedList.size() == 1 ? blockExpectedList.get(0) : blockExpectedList;
225-
226-
return new SyntheticSourceExample(textArray, textArray, blockExpected, this::mapping);
220+
return new SyntheticSourceExample(textArray, textArray, this::mapping);
227221
}
228222

229223
private record Value(String text, Integer tokenCount) {}
@@ -258,11 +252,6 @@ public List<SyntheticSourceInvalidExample> invalidExample() throws IOException {
258252
};
259253
}
260254

261-
protected Function<Object, Object> loadBlockExpected() {
262-
// we can get either a number from doc values or null
263-
return v -> v != null ? (Number) v : null;
264-
}
265-
266255
@Override
267256
protected IngestScriptSupport ingestScriptSupport() {
268257
throw new AssumptionViolatedException("not supported");

modules/transport-netty4/src/internalClusterTest/java/org/elasticsearch/http/netty4/Netty4IncrementalRequestHandlingIT.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public void testClientConnectionCloseMidStream() throws Exception {
205205

206206
// await stream handler is ready and request full content
207207
var handler = clientContext.awaitRestChannelAccepted(opaqueId);
208+
assertBusy(() -> assertNotEquals(0, handler.stream.bufSize()));
208209

209210
assertFalse(handler.isClosed());
210211

@@ -214,6 +215,7 @@ public void testClientConnectionCloseMidStream() throws Exception {
214215
assertEquals(requestTransmittedLength, handler.readUntilClose());
215216

216217
assertTrue(handler.isClosed());
218+
assertEquals(0, handler.stream.bufSize());
217219
}
218220
}
219221

@@ -230,6 +232,7 @@ public void testServerCloseConnectionMidStream() throws Exception {
230232

231233
// await stream handler is ready and request full content
232234
var handler = clientContext.awaitRestChannelAccepted(opaqueId);
235+
assertBusy(() -> assertNotEquals(0, handler.stream.bufSize()));
233236
assertFalse(handler.isClosed());
234237

235238
// terminate connection on server and wait resources are released
@@ -238,6 +241,7 @@ public void testServerCloseConnectionMidStream() throws Exception {
238241
handler.channel.request().getHttpChannel().close();
239242
assertThat(safeGet(exceptionFuture), instanceOf(ClosedChannelException.class));
240243
assertTrue(handler.isClosed());
244+
assertBusy(() -> assertEquals(0, handler.stream.bufSize()));
241245
}
242246
}
243247

@@ -253,6 +257,7 @@ public void testServerExceptionMidStream() throws Exception {
253257

254258
// await stream handler is ready and request full content
255259
var handler = clientContext.awaitRestChannelAccepted(opaqueId);
260+
assertBusy(() -> assertNotEquals(0, handler.stream.bufSize()));
256261
assertFalse(handler.isClosed());
257262

258263
// terminate connection on server and wait resources are released
@@ -264,6 +269,7 @@ public void testServerExceptionMidStream() throws Exception {
264269
final var exception = asInstanceOf(RuntimeException.class, safeGet(exceptionFuture));
265270
assertEquals(ServerRequestHandler.SIMULATED_EXCEPTION_MESSAGE, exception.getMessage());
266271
safeAwait(handler.closedLatch);
272+
assertBusy(() -> assertEquals(0, handler.stream.bufSize()));
267273
}
268274
}
269275

@@ -304,7 +310,7 @@ public void testClientBackpressure() throws Exception {
304310
});
305311
handler.readBytes(partSize);
306312
}
307-
assertTrue(handler.receivedLastChunk);
313+
assertTrue(handler.stream.hasLast());
308314
}
309315
}
310316

modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/MissingReadDetector.java

Lines changed: 0 additions & 78 deletions
This file was deleted.

modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpAggregator.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import io.netty.handler.codec.http.HttpObjectAggregator;
1616
import io.netty.handler.codec.http.HttpRequest;
1717
import io.netty.handler.codec.http.HttpRequestDecoder;
18-
import io.netty.handler.codec.http.LastHttpContent;
1918

2019
import org.elasticsearch.http.HttpPreRequest;
2120
import org.elasticsearch.http.netty4.internal.HttpHeadersAuthenticatorUtils;
@@ -49,9 +48,6 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
4948
}
5049
if (aggregating || msg instanceof FullHttpRequest) {
5150
super.channelRead(ctx, msg);
52-
if (msg instanceof LastHttpContent == false) {
53-
ctx.read(); // HttpObjectAggregator is tricky with auto-read off, it might not call read again, calling on its behalf
54-
}
5551
} else {
5652
streamContentSizeHandler.channelRead(ctx, msg);
5753
}

modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpContentSizeHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ private void handleRequest(ChannelHandlerContext ctx, HttpRequest request) {
123123
isContinueExpected = true;
124124
} else {
125125
ctx.writeAndFlush(EXPECTATION_FAILED_CLOSE.retainedDuplicate()).addListener(ChannelFutureListener.CLOSE);
126-
ctx.read();
127126
return;
128127
}
129128
}
@@ -137,7 +136,6 @@ private void handleRequest(ChannelHandlerContext ctx, HttpRequest request) {
137136
decoder.reset();
138137
}
139138
ctx.writeAndFlush(TOO_LARGE.retainedDuplicate()).addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
140-
ctx.read();
141139
} else {
142140
ignoreContent = false;
143141
currentContentLength = 0;
@@ -152,13 +150,11 @@ private void handleRequest(ChannelHandlerContext ctx, HttpRequest request) {
152150
private void handleContent(ChannelHandlerContext ctx, HttpContent msg) {
153151
if (ignoreContent) {
154152
msg.release();
155-
ctx.read();
156153
} else {
157154
currentContentLength += msg.content().readableBytes();
158155
if (currentContentLength > maxContentLength) {
159156
msg.release();
160157
ctx.writeAndFlush(TOO_LARGE_CLOSE.retainedDuplicate()).addListener(ChannelFutureListener.CLOSE);
161-
ctx.read();
162158
} else {
163159
ctx.fireChannelRead(msg);
164160
}

0 commit comments

Comments
 (0)