Skip to content

Commit 7731f08

Browse files
committed
Merge branch 'main' into lucene_snapshot
2 parents 3d77894 + 14f0b48 commit 7731f08

File tree

38 files changed

+3234
-1831
lines changed

38 files changed

+3234
-1831
lines changed

build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/PublishPluginFuncTest.groovy

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
7070
<distribution>repo</distribution>
7171
</license>
7272
<license>
73-
<name>Server Side Public License, v 1</name>
74-
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
73+
<name>GNU Affero General Public License Version 3</name>
74+
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
7575
<distribution>repo</distribution>
7676
</license>
7777
<license>
78-
<name>The OSI-approved Open Source license Version 3.0</name>
79-
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
78+
<name>Server Side Public License, v 1</name>
79+
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
8080
<distribution>repo</distribution>
8181
</license>
8282
</licenses>
@@ -150,13 +150,13 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
150150
<distribution>repo</distribution>
151151
</license>
152152
<license>
153-
<name>Server Side Public License, v 1</name>
154-
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
153+
<name>GNU Affero General Public License Version 3</name>
154+
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
155155
<distribution>repo</distribution>
156156
</license>
157157
<license>
158-
<name>The OSI-approved Open Source license Version 3.0</name>
159-
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
158+
<name>Server Side Public License, v 1</name>
159+
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
160160
<distribution>repo</distribution>
161161
</license>
162162
</licenses>
@@ -239,13 +239,13 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
239239
<distribution>repo</distribution>
240240
</license>
241241
<license>
242-
<name>Server Side Public License, v 1</name>
243-
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
242+
<name>GNU Affero General Public License Version 3</name>
243+
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
244244
<distribution>repo</distribution>
245245
</license>
246246
<license>
247-
<name>The OSI-approved Open Source license Version 3.0</name>
248-
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
247+
<name>Server Side Public License, v 1</name>
248+
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
249249
<distribution>repo</distribution>
250250
</license>
251251
</licenses>
@@ -337,13 +337,13 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
337337
<distribution>repo</distribution>
338338
</license>
339339
<license>
340-
<name>Server Side Public License, v 1</name>
341-
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
340+
<name>GNU Affero General Public License Version 3</name>
341+
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
342342
<distribution>repo</distribution>
343343
</license>
344344
<license>
345-
<name>The OSI-approved Open Source license Version 3.0</name>
346-
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
345+
<name>Server Side Public License, v 1</name>
346+
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
347347
<distribution>repo</distribution>
348348
</license>
349349
</licenses>
@@ -415,13 +415,13 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
415415
<distribution>repo</distribution>
416416
</license>
417417
<license>
418-
<name>Server Side Public License, v 1</name>
419-
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
418+
<name>GNU Affero General Public License Version 3</name>
419+
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v2.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
420420
<distribution>repo</distribution>
421421
</license>
422422
<license>
423-
<name>The OSI-approved Open Source license Version 3.0</name>
424-
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v2.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
423+
<name>Server Side Public License, v 1</name>
424+
<url>https://www.mongodb.com/licensing/server-side-public-license</url>
425425
<distribution>repo</distribution>
426426
</license>
427427
</licenses>

docs/changelog/112905.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 112905
2+
summary: "[ES|QL] Named parameter for field names and field name patterns"
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/114358.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 114358
2+
summary: "ESQL: Use less memory in listener"
3+
area: ES|QL
4+
type: enhancement
5+
issues: []

docs/changelog/114375.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 114375
2+
summary: Handle `InternalSendException` inline for non-forking handlers
3+
area: Distributed
4+
type: bug
5+
issues: []

muted-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,11 @@ tests:
368368
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
369369
method: test {yaml=reference/esql/esql-across-clusters/line_196}
370370
issue: https://github.com/elastic/elasticsearch/issues/114488
371+
- class: org.elasticsearch.gradle.internal.PublishPluginFuncTest
372+
issue: https://github.com/elastic/elasticsearch/issues/114492
373+
- class: org.elasticsearch.xpack.inference.DefaultElserIT
374+
method: testInferCreatesDefaultElser
375+
issue: https://github.com/elastic/elasticsearch/issues/114503
371376
- class: org.elasticsearch.search.retriever.rankdoc.RankDocsQueryBuilderTests
372377
method: testRankDocsQueryEarlyTerminate
373378
issue: https://github.com/elastic/elasticsearch/issues/114097

server/src/main/java/org/elasticsearch/common/util/LongObjectPagedHashMap.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public T get(long key) {
6363
* an insertion.
6464
*/
6565
public T put(long key, T value) {
66+
assert value != null : "Null values are not supported";
6667
if (size >= maxSize) {
6768
assert size == maxSize;
6869
grow();
@@ -94,9 +95,6 @@ public T remove(long key) {
9495
}
9596

9697
private T set(long key, T value) {
97-
if (value == null) {
98-
throw new IllegalArgumentException("Null values are not supported");
99-
}
10098
for (long i = slot(hash(key), mask);; i = nextSlot(i, mask)) {
10199
final T previous = values.getAndSet(i, value);
102100
if (previous == null) {
@@ -116,7 +114,7 @@ private T set(long key, T value) {
116114

117115
@Override
118116
public Iterator<Cursor<T>> iterator() {
119-
return new Iterator<Cursor<T>>() {
117+
return new Iterator<>() {
120118

121119
boolean cached;
122120
final Cursor<T> cursor;
@@ -181,9 +179,21 @@ protected boolean used(long bucket) {
181179
protected void removeAndAdd(long index) {
182180
final long key = keys.get(index);
183181
final T value = values.getAndSet(index, null);
184-
--size;
185-
final T removed = set(key, value);
186-
assert removed == null;
182+
reset(key, value);
183+
}
184+
185+
private void reset(long key, T value) {
186+
final ObjectArray<T> values = this.values;
187+
final long mask = this.mask;
188+
for (long i = slot(hash(key), mask);; i = nextSlot(i, mask)) {
189+
final T previous = values.get(i);
190+
if (previous == null) {
191+
// slot was free
192+
keys.set(i, key);
193+
values.set(i, value);
194+
break;
195+
}
196+
}
187197
}
188198

189199
public static final class Cursor<T> {

server/src/main/java/org/elasticsearch/common/util/ObjectObjectPagedHashMap.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public V get(K key) {
6767
* an insertion.
6868
*/
6969
public V put(K key, V value) {
70+
assert value != null : "Null values are not supported";
7071
if (size >= maxSize) {
7172
assert size == maxSize;
7273
grow();
@@ -100,7 +101,6 @@ public V remove(K key) {
100101

101102
private V set(K key, int code, V value) {
102103
assert key.hashCode() == code;
103-
assert value != null;
104104
assert size < maxSize;
105105
final long slot = slot(code, mask);
106106
for (long index = slot;; index = nextSlot(index, mask)) {
@@ -187,9 +187,22 @@ protected boolean used(long bucket) {
187187
protected void removeAndAdd(long index) {
188188
final K key = keys.get(index);
189189
final V value = values.getAndSet(index, null);
190-
--size;
191-
final V removed = set(key, key.hashCode(), value);
192-
assert removed == null;
190+
reset(key, value);
191+
}
192+
193+
private void reset(K key, V value) {
194+
final ObjectArray<V> values = this.values;
195+
final long mask = this.mask;
196+
final long slot = slot(key.hashCode(), mask);
197+
for (long index = slot;; index = nextSlot(index, mask)) {
198+
final V previous = values.get(index);
199+
if (previous == null) {
200+
// slot was free
201+
values.set(index, value);
202+
keys.set(index, key);
203+
break;
204+
}
205+
}
193206
}
194207

195208
public static final class Cursor<K, V> {

server/src/main/java/org/elasticsearch/transport/TransportService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,9 @@ private Executor getInternalSendExceptionExecutor(Executor handlerExecutor) {
10591059
if (lifecycle.stoppedOrClosed()) {
10601060
// too late to try and dispatch anywhere else, let's just use the calling thread
10611061
return EsExecutors.DIRECT_EXECUTOR_SERVICE;
1062-
} else if (handlerExecutor == EsExecutors.DIRECT_EXECUTOR_SERVICE) {
1063-
// if the handler is non-forking then dispatch to GENERIC to avoid a possible stack overflow
1062+
} else if (handlerExecutor == EsExecutors.DIRECT_EXECUTOR_SERVICE && enableStackOverflowAvoidance) {
1063+
// If the handler is non-forking and stack overflow protection is enabled then dispatch to GENERIC
1064+
// Otherwise we let the handler deal with any potential stack overflow (this is the default)
10641065
return threadPool.generic();
10651066
} else {
10661067
return handlerExecutor;

server/src/test/java/org/elasticsearch/transport/TransportServiceLifecycleTests.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,13 @@ public void testInternalSendExceptionForksToHandlerExecutor() {
149149
}
150150
}
151151

152-
public void testInternalSendExceptionForksToGenericIfHandlerDoesNotFork() {
153-
try (var nodeA = new TestNode("node-A")) {
152+
public void testInternalSendExceptionForksToGenericIfHandlerDoesNotForkAndStackOverflowProtectionEnabled() {
153+
try (
154+
var nodeA = new TestNode(
155+
"node-A",
156+
Settings.builder().put(TransportService.ENABLE_STACK_OVERFLOW_AVOIDANCE.getKey(), true).build()
157+
)
158+
) {
154159
final var future = new PlainActionFuture<TransportResponse.Empty>();
155160
nodeA.transportService.sendRequest(
156161
nodeA.getThrowingConnection(),
@@ -165,6 +170,33 @@ public void testInternalSendExceptionForksToGenericIfHandlerDoesNotFork() {
165170

166171
assertEquals("simulated exception in sendRequest", getSendRequestException(future, IOException.class).getMessage());
167172
}
173+
assertWarnings(
174+
"[transport.enable_stack_protection] setting was deprecated in Elasticsearch and will be removed in a future release."
175+
);
176+
}
177+
178+
public void testInternalSendExceptionWithNonForkingResponseHandlerCompletesListenerInline() {
179+
try (var nodeA = new TestNode("node-A")) {
180+
final Thread callingThread = Thread.currentThread();
181+
assertEquals(
182+
"simulated exception in sendRequest",
183+
safeAwaitAndUnwrapFailure(
184+
IOException.class,
185+
TransportResponse.Empty.class,
186+
l -> nodeA.transportService.sendRequest(
187+
nodeA.getThrowingConnection(),
188+
TestNode.randomActionName(random()),
189+
new EmptyRequest(),
190+
TransportRequestOptions.EMPTY,
191+
new ActionListenerResponseHandler<>(
192+
ActionListener.runBefore(l, () -> assertSame(callingThread, Thread.currentThread())),
193+
unusedReader(),
194+
EsExecutors.DIRECT_EXECUTOR_SERVICE
195+
)
196+
)
197+
).getMessage()
198+
);
199+
}
168200
}
169201

170202
public void testInternalSendExceptionForcesExecutionOnHandlerExecutor() {

0 commit comments

Comments
 (0)