Skip to content

Commit 20b2820

Browse files
authored
Merge branch 'main' into add_min_score_linear_retriever
2 parents b49c77d + 8502738 commit 20b2820

File tree

20 files changed

+141
-18
lines changed

20 files changed

+141
-18
lines changed

docs/changelog/126786.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 126786
2+
summary: Account for time taken to write index buffers in `IndexingMemoryController`
3+
area: Distributed
4+
type: enhancement
5+
issues: []

docs/reference/query-languages/esql/_snippets/functions/functionNamedParams/qstr.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/kibana/definition/functions/qstr.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/data-streams/src/internalClusterTest/java/org/elasticsearch/datastreams/DataStreamAutoshardingIT.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,9 @@ private static ShardStats getShardStats(IndexMetadata indexMeta, int shardIndex,
527527
CommonStats stats = new CommonStats();
528528
stats.docs = new DocsStats(100, 0, randomByteSizeValue().getBytes());
529529
stats.store = new StoreStats();
530-
stats.indexing = new IndexingStats(new IndexingStats.Stats(1, 1, 1, 1, 1, 1, 1, 1, 1, false, 1, targetWriteLoad, 1, 0.123, 0.234));
530+
stats.indexing = new IndexingStats(
531+
new IndexingStats.Stats(1, 1, 1, 1, 1, 1, 1, 1, 1, false, 1, targetWriteLoad, targetWriteLoad, 1, 0.123, 0.234)
532+
);
531533
return new ShardStats(shardRouting, new ShardPath(false, path, path, shardId), stats, null, null, null, false, 0);
532534
}
533535

server/src/internalClusterTest/java/org/elasticsearch/indices/IndexingMemoryControllerIT.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.Optional;
3030

3131
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
32+
import static org.hamcrest.Matchers.greaterThan;
3233
import static org.hamcrest.Matchers.lessThanOrEqualTo;
3334

3435
public class IndexingMemoryControllerIT extends ESSingleNodeTestCase {
@@ -37,7 +38,9 @@ public class IndexingMemoryControllerIT extends ESSingleNodeTestCase {
3738
protected Settings nodeSettings() {
3839
return Settings.builder()
3940
.put(super.nodeSettings())
40-
// small indexing buffer so that we can trigger refresh after buffering 100 deletes
41+
// small indexing buffer so that
42+
// 1. We can trigger refresh after buffering 100 deletes
43+
// 2. Indexing memory Controller writes indexing buffers in sync with indexing on the indexing thread
4144
.put("indices.memory.index_buffer_size", "1kb")
4245
.build();
4346
}
@@ -111,4 +114,22 @@ public void testDeletesAloneCanTriggerRefresh() throws Exception {
111114
}
112115
assertThat(shard.getEngineOrNull().getIndexBufferRAMBytesUsed(), lessThanOrEqualTo(ByteSizeUnit.KB.toBytes(1)));
113116
}
117+
118+
/* When there is memory pressure, we write indexing buffers to disk on the same thread as the indexing thread,
119+
* @see org.elasticsearch.indices.IndexingMemoryController.
120+
* This test verifies that we update the stats that capture the combined time for indexing + writing the
121+
* indexing buffers.
122+
* Note that the small indices.memory.index_buffer_size setting is required for this test to work.
123+
*/
124+
public void testIndexingUpdatesRelevantStats() throws Exception {
125+
IndexService indexService = createIndex("index", indexSettings(1, 0).put("index.refresh_interval", -1).build());
126+
IndexShard shard = indexService.getShard(0);
127+
prepareIndex("index").setSource("field", randomUnicodeOfCodepointLengthBetween(10, 25)).get();
128+
// Check that
129+
assertThat(shard.indexingStats().getTotal().getTotalIndexingExecutionTimeInMillis(), greaterThan(0L));
130+
assertThat(
131+
shard.indexingStats().getTotal().getTotalIndexingExecutionTimeInMillis(),
132+
greaterThan(shard.indexingStats().getTotal().getIndexTime().getMillis())
133+
);
134+
}
114135
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ static TransportVersion def(int id) {
163163
public static final TransportVersion BATCHED_QUERY_PHASE_VERSION_BACKPORT_8_X = def(8_841_0_19);
164164
public static final TransportVersion SEARCH_INCREMENTAL_TOP_DOCS_NULL_BACKPORT_8_19 = def(8_841_0_20);
165165
public static final TransportVersion ML_INFERENCE_SAGEMAKER_8_19 = def(8_841_0_21);
166+
public static final TransportVersion ESQL_REPORT_ORIGINAL_TYPES_BACKPORT_8_19 = def(8_841_0_22);
166167
public static final TransportVersion V_9_0_0 = def(9_000_0_09);
167168
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_1 = def(9_000_0_10);
168169
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_001_0_00);
@@ -234,7 +235,8 @@ static TransportVersion def(int id) {
234235
public static final TransportVersion AGGREGATE_METRIC_DOUBLE_BLOCK = def(9_067_00_0);
235236
public static final TransportVersion PINNED_RETRIEVER = def(9_068_0_00);
236237
public static final TransportVersion ML_INFERENCE_SAGEMAKER = def(9_069_0_00);
237-
public static final TransportVersion RANK_DOCS_QUERY_MIN_SCORE = def(9_070_0_00);
238+
public static final TransportVersion WRITE_LOAD_INCLUDES_BUFFER_WRITES = def(9_070_00_0);
239+
public static final TransportVersion RANK_DOCS_QUERY_MIN_SCORE = def(9_071_0_00);
238240

239241
/*
240242
* STOP! READ THIS FIRST! No, really,

0 commit comments

Comments
 (0)