Skip to content

Commit 3513985

Browse files
Merge branch 'main' into double-question-marks
2 parents 4007d9f + 33a2bc9 commit 3513985

File tree

25 files changed

+855
-162
lines changed

25 files changed

+855
-162
lines changed

build-tools-internal/src/main/groovy/elasticsearch.build-scan.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ develocity {
3232
// Automatically publish scans from Elasticsearch CI
3333
if (onCI) {
3434
publishing.onlyIf { true }
35-
server = 'https://gradle-enterprise.elastic.co'
35+
if(server.isPresent() == false) {
36+
server = 'https://gradle-enterprise.elastic.co'
37+
}
3638
} else if( server.isPresent() == false) {
3739
publishing.onlyIf { false }
3840
}

docs/changelog/122199.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122199
2+
summary: Fix issues that prevents using search only snapshots for indices that use index sorting. This is includes Logsdb and time series indices.
3+
area: Logs
4+
type: bug
5+
issues: []

docs/changelog/122496.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 122496
2+
summary: Deduplicate `IngestStats` and `IngestStats.Stats` identity records when deserializing
3+
area: Ingest Node
4+
type: bug
5+
issues: []

muted-tests.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,6 @@ tests:
368368
- class: org.elasticsearch.xpack.security.authz.IndexAliasesTests
369369
method: testRemoveIndex
370370
issue: https://github.com/elastic/elasticsearch/issues/122221
371-
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
372-
method: testGroupingMultiValueByOrdinals
373-
issue: https://github.com/elastic/elasticsearch/issues/122228
374-
- class: org.elasticsearch.xpack.esql.action.EsqlNodeFailureIT
375-
method: testFailureLoadingFields
376-
issue: https://github.com/elastic/elasticsearch/issues/122132
377371
- class: org.elasticsearch.blocks.SimpleBlocksIT
378372
method: testConcurrentAddBlock
379373
issue: https://github.com/elastic/elasticsearch/issues/122324
@@ -385,9 +379,6 @@ tests:
385379
- class: org.elasticsearch.xpack.esql.action.CrossClusterCancellationIT
386380
method: testCloseSkipUnavailable
387381
issue: https://github.com/elastic/elasticsearch/issues/122336
388-
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
389-
method: testUnsupportedTypesOrdinalGrouping
390-
issue: https://github.com/elastic/elasticsearch/issues/122342
391382
- class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT
392383
method: test {yaml=reference/alias/line_260}
393384
issue: https://github.com/elastic/elasticsearch/issues/122343
@@ -398,11 +389,6 @@ tests:
398389
issue: https://github.com/elastic/elasticsearch/issues/122377
399390
- class: org.elasticsearch.repositories.blobstore.testkit.analyze.HdfsRepositoryAnalysisRestIT
400391
issue: https://github.com/elastic/elasticsearch/issues/122378
401-
- class: org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT
402-
method: testStatsMissingFieldWithStats
403-
issue: https://github.com/elastic/elasticsearch/issues/122327
404-
- class: org.elasticsearch.xpack.esql.CsvTests
405-
issue: https://github.com/elastic/elasticsearch/issues/122440
406392

407393
# Examples:
408394
#

server/src/internalClusterTest/java/org/elasticsearch/persistent/PersistentTaskCreationFailureIT.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ public ClusterState execute(ClusterState currentState) {
7777
.pendingTasks()
7878
.stream()
7979
.filter(
80-
pendingClusterTask -> pendingClusterTask.getSource().string().equals("finish persistent task (failed)")
80+
pendingClusterTask -> pendingClusterTask.getSource()
81+
.string()
82+
.matches("finish persistent task \\[.*] \\(failed\\)")
8183
)
8284
.count();
8385
assertThat(completePersistentTaskPendingTasksCount, lessThanOrEqualTo(1L));

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,13 @@ static TransportVersion def(int id) {
173173
public static final TransportVersion INFERENCE_REQUEST_ADAPTIVE_RATE_LIMITING = def(8_839_0_00);
174174
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
175175
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED_BACKPORT_8_X = def(8_840_0_01);
176+
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_X = def(8_840_0_02);
176177
public static final TransportVersion ELASTICSEARCH_9_0 = def(9_000_0_00);
177178
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01);
178179
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90 = def(9_000_0_02);
179180
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION_90 = def(9_000_0_03);
180181
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION_90 = def(9_000_0_04);
182+
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_9_0 = def(9_000_0_05);
181183
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_001_0_00);
182184
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_002_0_00);
183185
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = def(9_003_0_00);

server/src/main/java/org/elasticsearch/action/support/IndexComponentSelector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ public static IndexComponentSelector getByKey(String key) {
7474

7575
public static IndexComponentSelector read(StreamInput in) throws IOException {
7676
byte id = in.readByte();
77-
if (in.getTransportVersion().onOrAfter(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR)) {
77+
if (in.getTransportVersion().onOrAfter(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR)
78+
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_9_0)
79+
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_X)) {
7880
return getById(id);
7981
} else {
8082
// Legacy value ::*, converted to ::data

server/src/main/java/org/elasticsearch/common/lucene/Lucene.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import org.apache.lucene.index.ConcurrentMergeScheduler;
2121
import org.apache.lucene.index.CorruptIndexException;
2222
import org.apache.lucene.index.DirectoryReader;
23+
import org.apache.lucene.index.FieldInfo;
24+
import org.apache.lucene.index.FieldInfos;
2325
import org.apache.lucene.index.FilterCodecReader;
2426
import org.apache.lucene.index.FilterDirectoryReader;
2527
import org.apache.lucene.index.FilterLeafReader;
@@ -190,14 +192,26 @@ public static SegmentInfos pruneUnreferencedFiles(String segmentsFileName, Direc
190192
throw new IllegalStateException("no commit found in the directory");
191193
}
192194
}
195+
// Need to figure out what the parent field is that, so that validation in IndexWriter doesn't fail
196+
// if no parent field is configured, but FieldInfo says there is a parent field.
197+
String parentField = null;
193198
final IndexCommit cp = getIndexCommit(si, directory);
199+
try (var reader = DirectoryReader.open(cp)) {
200+
var topLevelFieldInfos = FieldInfos.getMergedFieldInfos(reader);
201+
for (FieldInfo fieldInfo : topLevelFieldInfos) {
202+
if (fieldInfo.isParentField()) {
203+
parentField = fieldInfo.getName();
204+
}
205+
}
206+
}
194207
try (
195208
IndexWriter writer = new IndexWriter(
196209
directory,
197210
indexWriterConfigWithNoMerging(Lucene.STANDARD_ANALYZER).setSoftDeletesField(Lucene.SOFT_DELETES_FIELD)
198211
.setIndexCommit(cp)
199212
.setCommitOnClose(false)
200213
.setOpenMode(IndexWriterConfig.OpenMode.APPEND)
214+
.setParentField(parentField)
201215
)
202216
) {
203217
// do nothing and close this will kick off IndexFileDeleter which will remove all pending files

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ public IndexService(
232232
mapperMetrics
233233
);
234234
this.indexFieldData = new IndexFieldDataService(indexSettings, indicesFieldDataCache, circuitBreakerService);
235-
if (indexSettings.getIndexSortConfig().hasIndexSort()) {
235+
boolean sourceOnly = Boolean.parseBoolean(indexSettings.getSettings().get("index.source_only"));
236+
if (indexSettings.getIndexSortConfig().hasIndexSort() && sourceOnly == false) {
236237
// we delay the actual creation of the sort order for this index because the mapping has not been merged yet.
237238
// The sort order is validated right after the merge of the mapping later in the process.
238239
this.indexSortSupplier = () -> indexSettings.getIndexSortConfig()

server/src/main/java/org/elasticsearch/ingest/IngestStats.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,25 @@ public record IngestStats(Stats totalStats, List<PipelineStat> pipelineStats, Ma
5757
* Read from a stream.
5858
*/
5959
public static IngestStats read(StreamInput in) throws IOException {
60-
var stats = new Stats(in);
60+
var stats = readStats(in);
6161
var size = in.readVInt();
62+
if (stats == Stats.IDENTITY && size == 0) {
63+
return IDENTITY;
64+
}
6265
var pipelineStats = new ArrayList<PipelineStat>(size);
6366
var processorStats = Maps.<String, List<ProcessorStat>>newMapWithExpectedSize(size);
6467

6568
for (var i = 0; i < size; i++) {
6669
var pipelineId = in.readString();
67-
var pipelineStat = new Stats(in);
70+
var pipelineStat = readStats(in);
6871
var byteStat = in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0) ? new ByteStats(in) : new ByteStats(0, 0);
6972
pipelineStats.add(new PipelineStat(pipelineId, pipelineStat, byteStat));
7073
int processorsSize = in.readVInt();
7174
var processorStatsPerPipeline = new ArrayList<ProcessorStat>(processorsSize);
7275
for (var j = 0; j < processorsSize; j++) {
7376
var processorName = in.readString();
7477
var processorType = in.readString();
75-
var processorStat = new Stats(in);
78+
var processorStat = readStats(in);
7679
processorStatsPerPipeline.add(new ProcessorStat(processorName, processorType, processorStat));
7780
}
7881
processorStats.put(pipelineId, Collections.unmodifiableList(processorStatsPerPipeline));
@@ -167,20 +170,28 @@ static Map<String, List<ProcessorStat>> merge(Map<String, List<ProcessorStat>> f
167170
return totalsPerPipelineProcessor;
168171
}
169172

173+
/**
174+
* Read {@link Stats} from a stream.
175+
*/
176+
private static Stats readStats(StreamInput in) throws IOException {
177+
long ingestCount = in.readVLong();
178+
long ingestTimeInMillis = in.readVLong();
179+
long ingestCurrent = in.readVLong();
180+
long ingestFailedCount = in.readVLong();
181+
if (ingestCount == 0 && ingestTimeInMillis == 0 && ingestCurrent == 0 && ingestFailedCount == 0) {
182+
return Stats.IDENTITY;
183+
} else {
184+
return new Stats(ingestCount, ingestTimeInMillis, ingestCurrent, ingestFailedCount);
185+
}
186+
}
187+
170188
public record Stats(long ingestCount, long ingestTimeInMillis, long ingestCurrent, long ingestFailedCount)
171189
implements
172190
Writeable,
173191
ToXContentFragment {
174192

175193
public static final Stats IDENTITY = new Stats(0, 0, 0, 0);
176194

177-
/**
178-
* Read from a stream.
179-
*/
180-
public Stats(StreamInput in) throws IOException {
181-
this(in.readVLong(), in.readVLong(), in.readVLong(), in.readVLong());
182-
}
183-
184195
@Override
185196
public void writeTo(StreamOutput out) throws IOException {
186197
out.writeVLong(ingestCount);

0 commit comments

Comments
 (0)