Skip to content

Commit 05284eb

Browse files
committed
Merge remote-tracking branch 'elastic/main' into resolve-cluster/cluster-info-only
2 parents bd10f6e + f9b9007 commit 05284eb

File tree

21 files changed

+788
-112
lines changed

21 files changed

+788
-112
lines changed

docs/changelog/119772.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 119772
2+
summary: ESQL Support IN operator for Date nanos
3+
area: ES|QL
4+
type: enhancement
5+
issues:
6+
- 118578

docs/changelog/120084.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 120084
2+
summary: Improve how reindex data stream index action handles api blocks
3+
area: Data streams
4+
type: enhancement
5+
issues: []

modules/kibana/src/internalClusterTest/java/org/elasticsearch/kibana/KibanaThreadPoolIT.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
import org.elasticsearch.action.search.SearchRequest;
1717
import org.elasticsearch.action.support.WriteRequest;
1818
import org.elasticsearch.client.internal.Client;
19+
import org.elasticsearch.cluster.metadata.IndexMetadata;
20+
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
1921
import org.elasticsearch.common.settings.Settings;
2022
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
2123
import org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor;
2224
import org.elasticsearch.index.IndexingPressure;
2325
import org.elasticsearch.index.query.QueryBuilders;
2426
import org.elasticsearch.plugins.Plugin;
2527
import org.elasticsearch.test.ESIntegTestCase;
26-
import org.elasticsearch.test.junit.annotations.TestLogging;
2728
import org.elasticsearch.threadpool.ThreadPool;
2829
import org.elasticsearch.threadpool.ThreadPoolStats;
2930

@@ -49,10 +50,6 @@
4950
* threads that wait on a phaser. This lets us verify that operations on system indices
5051
* are being directed to other thread pools.</p>
5152
*/
52-
@TestLogging(
53-
reason = "investigate",
54-
value = "org.elasticsearch.kibana.KibanaThreadPoolIT:DEBUG,org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor:TRACE"
55-
)
5653
public class KibanaThreadPoolIT extends ESIntegTestCase {
5754
private static final Logger logger = LogManager.getLogger(KibanaThreadPoolIT.class);
5855

@@ -68,6 +65,8 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
6865
.put("thread_pool.write.queue_size", 1)
6966
.put("thread_pool.get.size", 1)
7067
.put("thread_pool.get.queue_size", 1)
68+
// a rejected GET may retry on an INITIALIZING shard (the target of a relocation) and unexpectedly succeed, so block rebalancing
69+
.put(EnableAllocationDecider.CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
7170
.build();
7271
}
7372

@@ -112,7 +111,12 @@ public void testKibanaThreadPoolByPassesBlockedThreadPools() throws Exception {
112111
}
113112

114113
public void testBlockedThreadPoolsRejectUserRequests() throws Exception {
115-
assertAcked(client().admin().indices().prepareCreate(USER_INDEX));
114+
assertAcked(
115+
client().admin()
116+
.indices()
117+
.prepareCreate(USER_INDEX)
118+
.setSettings(Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)) // avoid retrying rejected actions
119+
);
116120

117121
runWithBlockedThreadPools(this::assertThreadPoolsBlocked);
118122

muted-tests.yml

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ tests:
5252
- class: org.elasticsearch.xpack.transform.integration.TransformIT
5353
method: testStopWaitForCheckpoint
5454
issue: https://github.com/elastic/elasticsearch/issues/106113
55-
- class: org.elasticsearch.kibana.KibanaThreadPoolIT
56-
method: testBlockedThreadPoolsRejectUserRequests
57-
issue: https://github.com/elastic/elasticsearch/issues/113939
5855
- class: org.elasticsearch.xpack.inference.TextEmbeddingCrudIT
5956
method: testPutE5Small_withPlatformAgnosticVariant
6057
issue: https://github.com/elastic/elasticsearch/issues/113983
@@ -230,26 +227,8 @@ tests:
230227
- class: org.elasticsearch.xpack.inference.InferenceCrudIT
231228
method: testGetServicesWithCompletionTaskType
232229
issue: https://github.com/elastic/elasticsearch/issues/119959
233-
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
234-
method: testSearchableSnapshotUpgrade {p0=[9.0.0, 8.18.0, 8.18.0]}
235-
issue: https://github.com/elastic/elasticsearch/issues/119978
236-
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
237-
method: testSearchableSnapshotUpgrade {p0=[9.0.0, 9.0.0, 8.18.0]}
238-
issue: https://github.com/elastic/elasticsearch/issues/119979
239-
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
240-
method: testMountSearchableSnapshot {p0=[9.0.0, 8.18.0, 8.18.0]}
241-
issue: https://github.com/elastic/elasticsearch/issues/119550
242-
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
243-
method: testMountSearchableSnapshot {p0=[9.0.0, 9.0.0, 8.18.0]}
244-
issue: https://github.com/elastic/elasticsearch/issues/119980
245230
- class: org.elasticsearch.multi_cluster.MultiClusterYamlTestSuiteIT
246231
issue: https://github.com/elastic/elasticsearch/issues/119983
247-
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
248-
method: testMountSearchableSnapshot {p0=[9.0.0, 9.0.0, 9.0.0]}
249-
issue: https://github.com/elastic/elasticsearch/issues/119989
250-
- class: org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT
251-
method: testSearchableSnapshotUpgrade {p0=[9.0.0, 9.0.0, 9.0.0]}
252-
issue: https://github.com/elastic/elasticsearch/issues/119990
253232
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
254233
method: test {p0=transform/transforms_unattended/Test unattended put and start}
255234
issue: https://github.com/elastic/elasticsearch/issues/120019
@@ -275,6 +254,9 @@ tests:
275254
issue: https://github.com/elastic/elasticsearch/issues/120117
276255
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.MinioRepositoryAnalysisRestIT
277256
issue: https://github.com/elastic/elasticsearch/issues/118548
257+
- class: org.elasticsearch.xpack.security.QueryableReservedRolesIT
258+
method: testConfiguredReservedRolesAfterClosingAndOpeningIndex
259+
issue: https://github.com/elastic/elasticsearch/issues/120127
278260

279261
# Examples:
280262
#

rest-api-spec/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@ tasks.named("yamlRestCompatTestTransform").configure ({ task ->
8585
task.skipTest("search.vectors/110_knn_query_with_filter/PRE_FILTER: pre-filter across multiple aliases", "waiting for #118774 backport")
8686
task.skipTest("search.vectors/160_knn_query_missing_params/kNN search in a dis_max query - missing num_candidates", "waiting for #118774 backport")
8787
task.skipTest("search.highlight/30_max_analyzed_offset/Plain highlighter with max_analyzed_offset < 0 should FAIL", "semantics of test has changed")
88+
task.skipTest("indices.create/10_basic/Create lookup index", "default auto_expand_replicas was removed")
89+
task.skipTest("indices.create/10_basic/Create lookup index with one shard", "default auto_expand_replicas was removed")
8890
})

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.create/10_basic.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@
171171
index: test_lookup
172172

173173
- match: { test_lookup.settings.index.number_of_shards: "1"}
174-
- match: { test_lookup.settings.index.auto_expand_replicas: "0-all"}
175174

176175
---
177176
"Create lookup index with one shard":
@@ -196,7 +195,6 @@
196195
index: test_lookup
197196

198197
- match: { test_lookup.settings.index.number_of_shards: "1"}
199-
- match: { test_lookup.settings.index.auto_expand_replicas: "0-all"}
200198

201199
---
202200
"Create lookup index with two shards":

server/src/internalClusterTest/java/org/elasticsearch/index/LookupIndexModeIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void testBasic() {
4949
assertAcked(client().admin().indices().execute(TransportCreateIndexAction.TYPE, createRequest));
5050
Settings settings = client().admin().indices().prepareGetSettings("hosts").get().getIndexToSettings().get("hosts");
5151
assertThat(settings.get("index.mode"), equalTo("lookup"));
52-
assertThat(settings.get("index.auto_expand_replicas"), equalTo("0-all"));
52+
assertNull(settings.get("index.auto_expand_replicas"));
5353
Map<String, String> allHosts = Map.of(
5454
"192.168.1.2",
5555
"Windows",
@@ -141,7 +141,6 @@ public void testResizeLookupIndex() {
141141
Settings settings = client().admin().indices().prepareGetSettings("lookup-2").get().getIndexToSettings().get("lookup-2");
142142
assertThat(settings.get("index.mode"), equalTo("lookup"));
143143
assertThat(settings.get("index.number_of_shards"), equalTo("1"));
144-
assertThat(settings.get("index.auto_expand_replicas"), equalTo("0-all"));
145144

146145
ResizeRequest split = new ResizeRequest("lookup-3", "lookup-1");
147146
split.setResizeType(ResizeType.SPLIT);

server/src/main/java/org/elasticsearch/index/IndexMode.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -623,10 +623,7 @@ public Settings getAdditionalIndexSettings(
623623
}
624624
}
625625
if (indexMode == LOOKUP) {
626-
return Settings.builder()
627-
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
628-
.put(IndexMetadata.SETTING_AUTO_EXPAND_REPLICAS, "0-all")
629-
.build();
626+
return Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).build();
630627
} else {
631628
return Settings.EMPTY;
632629
}

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

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ final class TransportHandshaker {
4141
* ignores the body of the request. After the handshake, the OutboundHandler uses the min(local,remote) protocol version for all later
4242
* messages.
4343
*
44-
* This version supports two handshake protocols, v6080099 and v7170099, which respectively have the same message structure as the
45-
* transport protocols of v6.8.0 and v7.17.0. This node only sends v7170099 requests, but it can send a valid response to any v6080099
46-
* requests that it receives.
44+
* This version supports three handshake protocols, v6080099, v7170099 and v8800000, which respectively have the same message structure
45+
* as the transport protocols of v6.8.0, v7.17.0, and v8.18.0. This node only sends v7170099 requests, but it can send a valid response
46+
* to any v6080099 or v8800000 requests that it receives.
47+
*
48+
* Note that these are not really TransportVersion constants as used elsewhere in ES, they're independent things that just happen to be
49+
* stored in the same location in the message header and which roughly match the same ID numbering scheme. Older versions of ES did
50+
* rely on them matching the real transport protocol (which itself matched the release version numbers), but these days that's no longer
51+
* true.
4752
*
4853
* Here are some example messages, broken down to show their structure:
4954
*
@@ -79,7 +84,7 @@ final class TransportHandshaker {
7984
* c3 f9 eb 03 -- max acceptable protocol version (vInt: 00000011 11101011 11111001 11000011 == 8060099)
8085
*
8186
*
82-
* ## v7170099 Request:
87+
* ## v7170099 and v8800000 Requests:
8388
*
8489
* 45 53 -- 'ES' marker
8590
* 00 00 00 31 -- total message length
@@ -98,7 +103,7 @@ final class TransportHandshaker {
98103
* 04 -- payload length
99104
* c3 f9 eb 03 -- max acceptable protocol version (vInt: 00000011 11101011 11111001 11000011 == 8060099)
100105
*
101-
* ## v7170099 Response:
106+
* ## v7170099 and v8800000 Responses:
102107
*
103108
* 45 53 -- 'ES' marker
104109
* 00 00 00 17 -- total message length
@@ -118,7 +123,12 @@ final class TransportHandshaker {
118123

119124
static final TransportVersion EARLIEST_HANDSHAKE_VERSION = TransportVersion.fromId(6080099);
120125
static final TransportVersion REQUEST_HANDSHAKE_VERSION = TransportVersions.MINIMUM_COMPATIBLE;
121-
static final Set<TransportVersion> ALLOWED_HANDSHAKE_VERSIONS = Set.of(EARLIEST_HANDSHAKE_VERSION, REQUEST_HANDSHAKE_VERSION);
126+
static final TransportVersion V9_HANDSHAKE_VERSION = TransportVersion.fromId(8_800_00_0);
127+
static final Set<TransportVersion> ALLOWED_HANDSHAKE_VERSIONS = Set.of(
128+
EARLIEST_HANDSHAKE_VERSION,
129+
REQUEST_HANDSHAKE_VERSION,
130+
V9_HANDSHAKE_VERSION
131+
);
122132

123133
static final String HANDSHAKE_ACTION_NAME = "internal:tcp/handshake";
124134
private final ConcurrentMap<Long, HandshakeResponseHandler> pendingHandshakes = new ConcurrentHashMap<>();

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

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import static org.elasticsearch.common.bytes.ReleasableBytesReferenceStreamInputTests.wrapAsReleasable;
2929
import static org.hamcrest.Matchers.containsString;
30+
import static org.hamcrest.Matchers.greaterThan;
3031
import static org.hamcrest.Matchers.hasItems;
3132
import static org.hamcrest.Matchers.instanceOf;
3233

@@ -182,7 +183,7 @@ public void testDecodePreHeaderSizeVariableInt() throws IOException {
182183
}
183184
}
184185

185-
public void testDecodeHandshakeCompatibility() throws IOException {
186+
public void testDecodeHandshakeV7Compatibility() throws IOException {
186187
String action = "test-request";
187188
long requestId = randomNonNegativeLong();
188189
final String headerKey = randomAlphaOfLength(10);
@@ -223,6 +224,55 @@ public void testDecodeHandshakeCompatibility() throws IOException {
223224

224225
}
225226

227+
public void testDecodeHandshakeV8Compatibility() throws IOException {
228+
doHandshakeCompatibilityTest(TransportHandshaker.REQUEST_HANDSHAKE_VERSION, null);
229+
doHandshakeCompatibilityTest(TransportHandshaker.REQUEST_HANDSHAKE_VERSION, Compression.Scheme.DEFLATE);
230+
}
231+
232+
public void testDecodeHandshakeV9Compatibility() throws IOException {
233+
doHandshakeCompatibilityTest(TransportHandshaker.V9_HANDSHAKE_VERSION, null);
234+
doHandshakeCompatibilityTest(TransportHandshaker.V9_HANDSHAKE_VERSION, Compression.Scheme.DEFLATE);
235+
}
236+
237+
private void doHandshakeCompatibilityTest(TransportVersion transportVersion, Compression.Scheme compressionScheme) throws IOException {
238+
String action = "test-request";
239+
long requestId = randomNonNegativeLong();
240+
final String headerKey = randomAlphaOfLength(10);
241+
final String headerValue = randomAlphaOfLength(20);
242+
threadContext.putHeader(headerKey, headerValue);
243+
OutboundMessage message = new OutboundMessage.Request(
244+
threadContext,
245+
new TestRequest(randomAlphaOfLength(100)),
246+
transportVersion,
247+
action,
248+
requestId,
249+
true,
250+
compressionScheme
251+
);
252+
253+
try (RecyclerBytesStreamOutput os = new RecyclerBytesStreamOutput(recycler)) {
254+
final BytesReference bytes = message.serialize(os);
255+
int totalHeaderSize = TcpHeader.headerSize(transportVersion);
256+
257+
InboundDecoder decoder = new InboundDecoder(recycler);
258+
final ArrayList<Object> fragments = new ArrayList<>();
259+
final ReleasableBytesReference releasable1 = wrapAsReleasable(bytes);
260+
int bytesConsumed = decoder.decode(releasable1, fragments::add);
261+
assertThat(bytesConsumed, greaterThan(totalHeaderSize));
262+
assertTrue(releasable1.hasReferences());
263+
264+
final Header header = (Header) fragments.get(0);
265+
assertEquals(requestId, header.getRequestId());
266+
assertEquals(transportVersion, header.getVersion());
267+
assertEquals(compressionScheme == Compression.Scheme.DEFLATE, header.isCompressed());
268+
assertTrue(header.isHandshake());
269+
assertTrue(header.isRequest());
270+
assertFalse(header.needsToReadVariableHeader());
271+
assertEquals(headerValue, header.getRequestHeaders().get(headerKey));
272+
fragments.clear();
273+
}
274+
}
275+
226276
public void testClientChannelTypeFailsDecodingRequests() throws Exception {
227277
String action = "test-request";
228278
long requestId = randomNonNegativeLong();
@@ -488,23 +538,16 @@ public void testCheckVersionCompatibility() {
488538
}
489539

490540
public void testCheckHandshakeCompatibility() {
491-
try {
492-
InboundDecoder.checkHandshakeVersionCompatibility(randomFrom(TransportHandshaker.ALLOWED_HANDSHAKE_VERSIONS));
493-
} catch (IllegalStateException e) {
494-
throw new AssertionError(e);
495-
}
541+
for (final var allowedHandshakeVersion : TransportHandshaker.ALLOWED_HANDSHAKE_VERSIONS) {
542+
InboundDecoder.checkHandshakeVersionCompatibility(allowedHandshakeVersion); // should not throw
496543

497-
var invalid = TransportVersion.fromId(TransportHandshaker.EARLIEST_HANDSHAKE_VERSION.id() - 1);
498-
try {
499-
InboundDecoder.checkHandshakeVersionCompatibility(invalid);
500-
fail();
501-
} catch (IllegalStateException expected) {
544+
var invalid = TransportVersion.fromId(allowedHandshakeVersion.id() + randomFrom(-1, +1));
502545
assertEquals(
503546
"Received message from unsupported version: ["
504547
+ invalid
505548
+ "] allowed versions are: "
506549
+ TransportHandshaker.ALLOWED_HANDSHAKE_VERSIONS,
507-
expected.getMessage()
550+
expectThrows(IllegalStateException.class, () -> InboundDecoder.checkHandshakeVersionCompatibility(invalid)).getMessage()
508551
);
509552
}
510553
}

0 commit comments

Comments
 (0)