Skip to content

Commit 632d818

Browse files
Merge branch 'main' into get-alias-action-reduce-alloc
2 parents f117e48 + fbfc707 commit 632d818

File tree

12 files changed

+1132
-28
lines changed

12 files changed

+1132
-28
lines changed

docs/reference/elasticsearch/index-settings/slow-log.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ If you aren’t sure how to start investigating traffic issues, consider enablin
216216

217217
Slow log thresholds being met does not guarantee cluster performance issues. In the event that symptoms are noticed, slow logs can provide helpful data to diagnose upstream traffic patterns or sources to resolve client-side issues. For example, you can use data included in `X-Opaque-ID`, the `_source` request body, or `user.*` fields to identify the source of your issue. This is similar to troubleshooting [live expensive tasks](docs-content://troubleshoot/elasticsearch/task-queue-backlog.md).
218218

219-
If you’re experiencing search performance issues, then you might also consider investigating searches flagged for their query durations using the [profile API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-profile.html). You can then use the profiled query to investigate optimization options using the [query profiler](docs-content://explore-analyze/query-filter/tools/search-profiler.md). This type of investigation should usually take place in a non-production environment.
219+
If you’re experiencing search performance issues, then you might also consider investigating searches flagged for their query durations using the [profile API](/reference/elasticsearch/rest-apis/search-profile.md). You can then use the profiled query to investigate optimization options using the [query profiler](docs-content://explore-analyze/query-filter/tools/search-profiler.md). This type of investigation should usually take place in a non-production environment.
220220

221221
Slow logging checks each event against the reporting threshold when the event is complete. This means that it can’t report if events trigger [circuit breaker errors](docs-content://troubleshoot/elasticsearch/circuit-breaker-errors.md). If suspect circuit breaker errors, then you should also consider enabling [audit logging](docs-content://deploy-manage/security/logging-configuration/enabling-audit-logs.md), which logs events before they are executed.
222222

docs/reference/elasticsearch/rest-apis/reciprocal-rank-fusion.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The `rrf` retriever supports:
108108
* [suggesters](/reference/elasticsearch/rest-apis/search-suggesters.md)
109109
* [highlighting](/reference/elasticsearch/rest-apis/highlighting.md)
110110
* [collapse](/reference/elasticsearch/rest-apis/collapse-search-results.md)
111-
* [profiling](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-profile.html#profiling-queries)
111+
* [profiling](/reference/elasticsearch/rest-apis/search-profile.md)
112112

113113
The `rrf` retriever does not currently support:
114114

docs/reference/elasticsearch/rest-apis/search-profile.md

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

docs/reference/elasticsearch/toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ toc:
9898
- file: rest-apis/create-index-from-source.md
9999
- file: rest-apis/shard-request-cache.md
100100
- file: rest-apis/search-suggesters.md
101+
- file: rest-apis/search-profile.md
101102
- file: mapping-reference/index.md
102103
children:
103104
- file: mapping-reference/document-metadata-fields.md

muted-tests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,12 @@ tests:
405405
- class: org.elasticsearch.search.SearchWithRejectionsIT
406406
method: testOpenContextsAfterRejections
407407
issue: https://github.com/elastic/elasticsearch/issues/126340
408+
- class: org.elasticsearch.xpack.ilm.ClusterStateWaitThresholdBreachTests
409+
method: testWaitInShrunkShardsAllocatedExceedsThreshold
410+
issue: https://github.com/elastic/elasticsearch/issues/126348
411+
- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT
412+
method: testSearchableSnapshotTotalShardsPerNode
413+
issue: https://github.com/elastic/elasticsearch/issues/126354
408414

409415
# Examples:
410416
#

server/src/main/java/org/elasticsearch/cluster/metadata/IndexReshardingMetadata.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.elasticsearch.common.io.stream.StreamInput;
1313
import org.elasticsearch.common.io.stream.StreamOutput;
1414
import org.elasticsearch.common.io.stream.Writeable;
15+
import org.elasticsearch.core.Nullable;
1516
import org.elasticsearch.index.shard.ShardId;
1617
import org.elasticsearch.xcontent.ConstructingObjectParser;
1718
import org.elasticsearch.xcontent.ParseField;
@@ -20,7 +21,6 @@
2021
import org.elasticsearch.xcontent.XContentParser;
2122

2223
import java.io.IOException;
23-
import java.util.Arrays;
2424
import java.util.Objects;
2525

2626
/**
@@ -207,16 +207,18 @@ public static IndexReshardingMetadata newSplitByMultiple(int shardCount, int mul
207207
return new IndexReshardingMetadata(IndexReshardingState.Split.newSplitByMultiple(shardCount, multiple));
208208
}
209209

210-
public IndexReshardingMetadata transitionSplitTargetToHandoff(ShardId shardId) {
210+
public static boolean isSplitTarget(ShardId shardId, @Nullable IndexReshardingMetadata reshardingMetadata) {
211+
return reshardingMetadata != null && reshardingMetadata.isSplit() && reshardingMetadata.getSplit().isTargetShard(shardId.id());
212+
}
213+
214+
public IndexReshardingMetadata transitionSplitTargetToNewState(
215+
ShardId shardId,
216+
IndexReshardingState.Split.TargetShardState newTargetState
217+
) {
211218
assert state instanceof IndexReshardingState.Split;
212-
IndexReshardingState.Split splitState = (IndexReshardingState.Split) state;
213-
IndexReshardingState.Split.TargetShardState[] newTargets = Arrays.copyOf(
214-
splitState.targetShards(),
215-
splitState.targetShards().length
216-
);
217-
int i = shardId.getId() - state.shardCountBefore();
218-
newTargets[i] = IndexReshardingState.Split.TargetShardState.HANDOFF;
219-
return new IndexReshardingMetadata(new IndexReshardingState.Split(splitState.sourceShards(), newTargets));
219+
IndexReshardingState.Split.Builder builder = new IndexReshardingState.Split.Builder((IndexReshardingState.Split) state);
220+
builder.setTargetShardState(shardId.getId(), newTargetState);
221+
return new IndexReshardingMetadata(builder.build());
220222
}
221223

222224
/**

server/src/main/java/org/elasticsearch/cluster/metadata/IndexReshardingState.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Arrays;
2424
import java.util.List;
2525
import java.util.Objects;
26+
import java.util.stream.Stream;
2627

2728
/**
2829
* IndexReshardingState is an abstract class holding the persistent state of a generic resharding operation. It contains
@@ -366,6 +367,10 @@ public TargetShardState getTargetShardState(int shardNum) {
366367
return targetShards[targetShardNum];
367368
}
368369

370+
public boolean targetStateAtLeast(int shardNum, TargetShardState targetShardState) {
371+
return getTargetShardState(shardNum).ordinal() >= targetShardState.ordinal();
372+
}
373+
369374
/**
370375
* Check whether this metadata represents an incomplete split
371376
* @return true if the split is incomplete (not all source shards are DONE)
@@ -380,6 +385,10 @@ public boolean inProgress() {
380385
return false;
381386
}
382387

388+
public Stream<TargetShardState> targetStates() {
389+
return Arrays.stream(targetShards);
390+
}
391+
383392
/**
384393
* Check whether all target shards for the given source shard are done.
385394
* @param shardNum a source shard index greater than or equal to 0 and less than the original shard count

server/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import java.util.function.IntFunction;
5151

5252
import static java.util.Map.entry;
53-
import static org.elasticsearch.TransportVersions.V_8_11_X;
5453

5554
/**
5655
* A stream from another node to this node. Technically, it can also be streamed from a byte array but that is mostly for testing.
@@ -813,13 +812,10 @@ public final void writeOptionalInstant(@Nullable Instant instant) throws IOExcep
813812
entry(GenericNamedWriteable.class, (o, v) -> {
814813
// Note that we do not rely on the checks in VersionCheckingStreamOutput because that only applies to CCS
815814
final var genericNamedWriteable = (GenericNamedWriteable) v;
816-
TransportVersion minSupportedVersion = genericNamedWriteable.getMinimalSupportedVersion();
817-
assert minSupportedVersion.onOrAfter(V_8_11_X) : "[GenericNamedWriteable] requires [" + V_8_11_X + "]";
818-
if (o.getTransportVersion().before(minSupportedVersion)) {
815+
if (genericNamedWriteable.supportsVersion(o.getTransportVersion()) == false) {
819816
final var message = Strings.format(
820-
"[%s] requires minimal transport version [%s] and cannot be sent using transport version [%s]",
817+
"[%s] doesn't support serialization with transport version [%s]",
821818
genericNamedWriteable.getWriteableName(),
822-
minSupportedVersion,
823819
o.getTransportVersion()
824820
);
825821
assert false : message;

server/src/test/java/org/elasticsearch/cluster/metadata/IndexReshardingMetadataTests.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ public void testSplit() {
2121
var split = metadata.getSplit();
2222

2323
// starting state is as expected
24-
assert metadata.shardCountBefore() == numShards;
25-
assert metadata.shardCountAfter() == numShards * multiple;
24+
assertEquals(numShards, metadata.shardCountBefore());
25+
assertEquals(numShards * multiple, metadata.shardCountAfter());
2626
for (int i = 0; i < numShards; i++) {
27-
assert split.getSourceShardState(i) == IndexReshardingState.Split.SourceShardState.SOURCE;
27+
assertSame(IndexReshardingState.Split.SourceShardState.SOURCE, split.getSourceShardState(i));
28+
assertFalse(split.isTargetShard(i));
2829
}
2930
for (int i = numShards; i < numShards * multiple; i++) {
30-
assert split.getTargetShardState(i) == IndexReshardingState.Split.TargetShardState.CLONE;
31+
assertSame(IndexReshardingState.Split.TargetShardState.CLONE, split.getTargetShardState(i));
32+
assertTrue(split.isTargetShard(i));
3133
}
3234

3335
// advance split state randomly and expect to terminate
@@ -62,10 +64,12 @@ public void testSplit() {
6264
}
6365

6466
for (int i = 0; i < numShards; i++) {
65-
assert split.getSourceShardState(i) == IndexReshardingState.Split.SourceShardState.DONE;
67+
assertSame(IndexReshardingState.Split.SourceShardState.DONE, split.getSourceShardState(i));
68+
assertFalse(split.isTargetShard(i));
6669
}
6770
for (int i = numShards; i < numShards * multiple; i++) {
68-
assert split.getTargetShardState(i) == IndexReshardingState.Split.TargetShardState.DONE;
71+
assertSame(IndexReshardingState.Split.TargetShardState.DONE, split.getTargetShardState(i));
72+
assertTrue(split.isTargetShard(i));
6973
}
7074
}
7175
}

server/src/test/java/org/elasticsearch/search/geo/GeoBoundsGenericWriteableTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void testSerializationFailsWithOlderVersion() {
8585
output.setTransportVersion(older);
8686
assertThat(
8787
expectThrows(Throwable.class, () -> output.writeGenericValue(testInstance)).getMessage(),
88-
containsString("[GeoBoundingBox] requires minimal transport version")
88+
containsString("[GeoBoundingBox] doesn't support serialization with transport version")
8989
);
9090
}
9191
}

0 commit comments

Comments
 (0)