Skip to content

Commit 8f68c0b

Browse files
smalyshevnik9000
andauthored
Revert "[ESQL] Introduce pluggable external datasource framework (#141678) (#142663)
* Revert "[ESQL] Introduce pluggable external datasource framework (#141678)" This reverts commit 6acdb30. It's causing HeapAttackIT to fail in serverless. On some machines. But not others! How exciting. For now, we'll revert and then try and get it back more slowly. Co-authored-by: Nik Everett <nik9000@gmail.com>
1 parent 28b169c commit 8f68c0b

File tree

280 files changed

+3524
-34592
lines changed

Some content is hidden

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

280 files changed

+3524
-34592
lines changed

build-tools-internal/version.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ cuvs_java = 25.12.0
2424
ldapsdk = 7.0.3
2525

2626
antlr4 = 4.13.1
27-
iceberg = 1.10.1
2827
# bouncy castle version for non-fips. fips jars use a different version
2928
bouncycastle=1.79
3029
# used by security and idp (need to be in sync due to cross-dependency in testing)

gradle/verification-metadata.xml

Lines changed: 0 additions & 295 deletions
Large diffs are not rendered by default.

test/fixtures/s3-fixture/src/main/java/fixture/s3/S3HttpHandler.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ public void handle(final HttpExchange exchange) throws IOException {
118118
if (blob == null) {
119119
exchange.sendResponseHeaders(RestStatus.NOT_FOUND.getStatus(), -1);
120120
} else {
121-
// HEAD response must include Content-Length header for S3 clients (AWS SDK) that read file size
122-
exchange.getResponseHeaders().add("Content-Length", String.valueOf(blob.length()));
123-
exchange.getResponseHeaders().add("Content-Type", "application/octet-stream");
124121
exchange.sendResponseHeaders(RestStatus.OK.getStatus(), -1);
125122
}
126123
} else if (request.isListMultipartUploadsRequest()) {
@@ -184,9 +181,6 @@ public void handle(final HttpExchange exchange) throws IOException {
184181
exchange.sendResponseHeaders(RestStatus.NOT_FOUND.getStatus(), -1);
185182
} else {
186183
var range = parsePartRange(exchange);
187-
if (range.end() == null) {
188-
throw new AssertionError("Copy-part range must specify an end: " + range);
189-
}
190184
int start = Math.toIntExact(range.start());
191185
int len = Math.toIntExact(range.end() - range.start() + 1);
192186
var part = sourceBlob.slice(start, len);
@@ -385,15 +379,16 @@ public void handle(final HttpExchange exchange) throws IOException {
385379
return;
386380
}
387381

388-
// S3 supports https://www.rfc-editor.org/rfc/rfc9110.html#name-range
389-
// This handler supports both bounded ranges (bytes=0-100) and open-ended ranges (bytes=100-)
382+
// S3 supports https://www.rfc-editor.org/rfc/rfc9110.html#name-range. The AWS SDK v1.x seems to always generate range
383+
// requests with a header value like "Range: bytes=start-end" where both {@code start} and {@code end} are always defined
384+
// (sometimes to very high value for {@code end}). It would be too tedious to fully support the RFC so S3HttpHandler only
385+
// supports when both {@code start} and {@code end} are defined to match the SDK behavior.
390386
final HttpHeaderParser.Range range = parseRangeHeader(rangeHeader);
391387
if (range == null) {
392388
throw new AssertionError("Bytes range does not match expected pattern: " + rangeHeader);
393389
}
394390
long start = range.start();
395-
// For open-ended ranges (bytes=N-), end is null, meaning "to end of file"
396-
long end = range.end() != null ? range.end() : blob.length() - 1;
391+
long end = range.end();
397392
if (end < start) {
398393
exchange.getResponseHeaders().add("Content-Type", "application/octet-stream");
399394
exchange.sendResponseHeaders(RestStatus.OK.getStatus(), blob.length());

test/framework/src/main/java/org/elasticsearch/test/fixture/HttpHeaderParser.java

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,13 @@
1515
public enum HttpHeaderParser {
1616
;
1717

18-
// Pattern supports both bounded ranges (bytes=0-100) and open-ended ranges (bytes=100-)
19-
private static final Pattern RANGE_HEADER_PATTERN = Pattern.compile("bytes=([0-9]+)-([0-9]*)");
18+
private static final Pattern RANGE_HEADER_PATTERN = Pattern.compile("bytes=([0-9]+)-([0-9]+)");
2019
private static final Pattern CONTENT_RANGE_HEADER_PATTERN = Pattern.compile("bytes (?:(\\d+)-(\\d+)|\\*)/(?:(\\d+)|\\*)");
2120

2221
/**
2322
* Parse a "Range" header
2423
*
25-
* Supports both bounded and open-ended ranges:
26-
* <ul>
27-
* <li>Bounded: <code>Range: bytes={range_start}-{range_end}</code></li>
28-
* <li>Open-ended: <code>Range: bytes={range_start}-</code> (end is null, meaning "to end of file")</li>
29-
* </ul>
24+
* Note: only a single bounded range is supported (e.g. <code>Range: bytes={range_start}-{range_end}</code>)
3025
*
3126
* @see <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range">MDN: Range header</a>
3227
* @param rangeHeaderValue The header value as a string
@@ -36,38 +31,18 @@ public static Range parseRangeHeader(String rangeHeaderValue) {
3631
final Matcher matcher = RANGE_HEADER_PATTERN.matcher(rangeHeaderValue);
3732
if (matcher.matches()) {
3833
try {
39-
long start = Long.parseLong(matcher.group(1));
40-
String endGroup = matcher.group(2);
41-
Long end = (endGroup == null || endGroup.isEmpty()) ? null : Long.parseLong(endGroup);
42-
return new Range(start, end);
34+
return new Range(Long.parseLong(matcher.group(1)), Long.parseLong(matcher.group(2)));
4335
} catch (NumberFormatException e) {
4436
return null;
4537
}
4638
}
4739
return null;
4840
}
4941

50-
/**
51-
* A HTTP "Range" from a Range header.
52-
*
53-
* @param start The start of the range (always present)
54-
* @param end The end of the range, or null for open-ended ranges (meaning "to end of file")
55-
*/
56-
public record Range(long start, Long end) {
57-
58-
public Range(long start, long end) {
59-
this(start, (Long) end);
60-
}
61-
62-
/**
63-
* Returns true if this is an open-ended range (no end specified).
64-
*/
65-
public boolean isOpenEnded() {
66-
return end == null;
67-
}
42+
public record Range(long start, long end) {
6843

6944
public String headerString() {
70-
return end != null ? "bytes=" + start + "-" + end : "bytes=" + start + "-";
45+
return "bytes=" + start + "-" + end;
7146
}
7247
}
7348

test/framework/src/test/java/org/elasticsearch/http/HttpHeaderParserTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ public void testParseRangeHeaderMultipleRangesNotMatched() {
4343
);
4444
}
4545

46-
public void testParseRangeHeaderEndlessRange() {
47-
var bytes = randomLongBetween(0, Long.MAX_VALUE);
48-
assertEquals(new HttpHeaderParser.Range(bytes, null), HttpHeaderParser.parseRangeHeader(Strings.format("bytes=%d-", bytes)));
46+
public void testParseRangeHeaderEndlessRangeNotMatched() {
47+
assertNull(HttpHeaderParser.parseRangeHeader(Strings.format("bytes=%d-", randomLongBetween(0, Long.MAX_VALUE))));
4948
}
5049

5150
public void testParseRangeHeaderSuffixLengthNotMatched() {

x-pack/plugin/esql-datasource-csv/build.gradle

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

x-pack/plugin/esql-datasource-csv/licenses/jackson-LICENSE.txt

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

x-pack/plugin/esql-datasource-csv/licenses/jackson-NOTICE.txt

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

x-pack/plugin/esql-datasource-csv/qa/build.gradle

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

x-pack/plugin/esql-datasource-csv/qa/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/csv/Clusters.java

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

0 commit comments

Comments
 (0)