Skip to content

Commit 61d8835

Browse files
authored
Merge branch 'main' into rehydrate_source_vectors_nested
2 parents 3bd7d50 + e0f4cff commit 61d8835

File tree

3 files changed

+43
-20
lines changed

3 files changed

+43
-20
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"inference.put_custom": {
3+
"documentation": {
4+
"url": "https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-custom",
5+
"description": "Configure a custom inference endpoint"
6+
},
7+
"stability": "stable",
8+
"visibility": "public",
9+
"headers": {
10+
"accept": ["application/json"],
11+
"content_type": ["application/json"]
12+
},
13+
"url": {
14+
"paths": [
15+
{
16+
"path": "/_inference/{task_type}/{custom_inference_id}",
17+
"methods": ["PUT"],
18+
"parts": {
19+
"task_type": {
20+
"type": "string",
21+
"description": "The task type"
22+
},
23+
"custom_inference_id": {
24+
"type": "string",
25+
"description": "The inference Id"
26+
}
27+
}
28+
}
29+
]
30+
},
31+
"body": {
32+
"description": "The inference endpoint's task and service settings"
33+
}
34+
}
35+
}

server/src/internalClusterTest/java/org/elasticsearch/index/engine/ThreadPoolMergeSchedulerStressTestIT.java

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.elasticsearch.action.admin.indices.segments.IndexShardSegments;
1717
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentResponse;
1818
import org.elasticsearch.action.admin.indices.segments.ShardSegments;
19+
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
1920
import org.elasticsearch.common.settings.Settings;
2021
import org.elasticsearch.common.util.CollectionUtils;
2122
import org.elasticsearch.common.util.concurrent.ConcurrentCollections;
@@ -44,6 +45,7 @@
4445
import java.util.concurrent.atomic.AtomicReference;
4546

4647
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
48+
import static org.hamcrest.Matchers.equalTo;
4749
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
4850
import static org.hamcrest.Matchers.instanceOf;
4951
import static org.hamcrest.Matchers.is;
@@ -272,12 +274,11 @@ public void testMergingFallsBehindAndThenCatchesUp() throws Exception {
272274
assertThat(testEnginePlugin.enqueuedMergesSet.size(), is(0));
273275
testEnginePlugin.mergeExecutorServiceReference.get().allDone();
274276
}, 1, TimeUnit.MINUTES);
275-
var segmentsCountAfterMergingCaughtUp = getSegmentsCountForAllShards("index");
276-
// force merge should be a noop after all available merging was done
277-
assertAllSuccessful(indicesAdmin().prepareForceMerge("index").get());
278-
var segmentsCountAfterForceMerge = getSegmentsCountForAllShards("index");
279-
assertThat(segmentsCountAfterForceMerge, is(segmentsCountAfterMergingCaughtUp));
280-
// let's also run a force-merge to 1 segment
277+
// indices stats says that no merge is currently running (meaning merging did catch up)
278+
IndicesStatsResponse indicesStatsResponse = client().admin().indices().prepareStats("index").setMerge(true).get();
279+
long currentMergeCount = indicesStatsResponse.getIndices().get("index").getPrimaries().merge.getCurrent();
280+
assertThat(currentMergeCount, equalTo(0L));
281+
// run a force-merge to 1 segment to make sure nothing is broken
281282
assertAllSuccessful(indicesAdmin().prepareForceMerge("index").setMaxNumSegments(1).get());
282283
assertAllSuccessful(indicesAdmin().prepareRefresh("index").get());
283284
// assert one segment per shard
@@ -292,20 +293,6 @@ public void testMergingFallsBehindAndThenCatchesUp() throws Exception {
292293
}
293294
}
294295

295-
private int getSegmentsCountForAllShards(String indexName) {
296-
// refresh, otherwise we'd be still seeing the old merged-away segments
297-
assertAllSuccessful(indicesAdmin().prepareRefresh(indexName).get());
298-
int count = 0;
299-
IndicesSegmentResponse indicesSegmentResponse = indicesAdmin().prepareSegments(indexName).get();
300-
Iterator<IndexShardSegments> indexShardSegmentsIterator = indicesSegmentResponse.getIndices().get(indexName).iterator();
301-
while (indexShardSegmentsIterator.hasNext()) {
302-
for (ShardSegments segments : indexShardSegmentsIterator.next()) {
303-
count += segments.getSegments().size();
304-
}
305-
}
306-
return count;
307-
}
308-
309296
private TestEnginePlugin getTestEnginePlugin() {
310297
return getInstanceFromNode(PluginsService.class).filterPlugins(TestEnginePlugin.class).toList().get(0);
311298
}

server/src/test/java/org/elasticsearch/index/engine/ThreadPoolMergeExecutorServiceTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ public void testIORateIsAdjustedForAllRunningMergeTasks() throws Exception {
328328
ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) testThreadPool.executor(ThreadPool.Names.MERGE);
329329
Semaphore runMergeSemaphore = new Semaphore(0);
330330
Set<MergeTask> currentlyRunningMergeTasksSet = ConcurrentCollections.newConcurrentSet();
331+
331332
while (mergesStillToComplete > 0) {
332333
if (mergesStillToSubmit > 0 && (currentlyRunningMergeTasksSet.isEmpty() || randomBoolean())) {
333334
MergeTask mergeTask = mock(MergeTask.class);

0 commit comments

Comments
 (0)