Skip to content

Commit 0713f7c

Browse files
committed
Merge remote-tracking branch 'upstream/main' into skip-rest-compat-synthetic-source-tests
2 parents 4bf9d9c + fe2f1fe commit 0713f7c

File tree

12 files changed

+230
-134
lines changed

12 files changed

+230
-134
lines changed

docs/reference/elasticsearch/index-lifecycle-actions/ilm-forcemerge.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,30 @@ mapped_pages:
77

88
Phases allowed: hot, warm.
99

10-
[Force merges](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge) the index into the specified maximum number of [segments](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-segments).
11-
12-
::::{note}
13-
Shards that are relocating during a `forcemerge` will not be merged.
14-
::::
15-
10+
[Force merges](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge) the index into the specified maximum number of [segments](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-segments). This operation is performed on a best effort basis. For example, shards that are relocating during a `forcemerge` will not be merged.
1611

1712
To use the `forcemerge` action in the `hot` phase, the `rollover` action **must** be present. If no rollover action is configured, {{ilm-init}} will reject the policy.
1813

1914
:::::{admonition} Performance considerations
2015
:name: ilm-forcemerge-performance
2116

22-
Force merge is a resource-intensive operation. If too many force merges are triggered at once, it can negatively impact your cluster. This can happen when you apply an {{ilm-init}} policy that includes a force merge action to existing indices. If they meet the `min_age` criteria, they can immediately proceed through multiple phases. You can prevent this by increasing the `min_age` or setting `index.lifecycle.origination_date` to change how the index age is calculated.
17+
Force merge is a resource-intensive operation. If too many force merges are triggered at once, it can negatively impact your cluster. For example, this can happen when you
18+
* modify an existing {{ilm-init}} policy's phase `min_age`, causing indices to trigger the force merge at a faster rate.
19+
* apply an {{ilm-init}} policy that includes a force merge action to existing indices. If the indices meet the `min_age` criteria, they can immediately proceed through multiple actions. You can prevent this by increasing the `min_age` or setting `index.lifecycle.origination_date` to change how the index age is calculated.
20+
* run the [{{ilm-init}} Move Step API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ilm-move-to-step) against multiple indices.
2321

2422
If you experience a force merge task queue backlog, you might need to increase the size of the force merge threadpool so indices can be force merged in parallel. To do this, configure the `thread_pool.force_merge.size` [cluster setting](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-get-settings).
2523

2624
::::{important}
27-
This can have cascading performance impacts. Monitor cluster performance and increment the size of the thread pool slowly to reduce the backlog.
25+
Note that `thread_pool.force_merge.size` is an advanced setting. Adjusting it can cause cascading performance impacts. Monitor cluster performance and increment the size of the thread pool slowly to reduce the backlog.
2826
::::
2927

28+
Force merging will be performed by the node hosting the shard. Usually, the [node's role](docs-content://deploy-manage/distributed-architecture/clusters-nodes-shards/node-roles.md#set-node-roles) matches the [data tier](docs-content://manage-data/lifecycle/data-tiers.md) of the {{ilm-init}} phase that the index is in. One of the exceptions is when you have manually disabled [ILM Migrate](https://www.elastic.co/docs/reference/elasticsearch/index-lifecycle-actions/ilm-migrate) and have specified custom allocations using [ILM allocate](https://www.elastic.co/docs/reference/elasticsearch/index-lifecycle-actions/ilm-allocate). The other exception is searchable snapshots; force merges for [{{ilm-init}} Searchable Snapshots](./ilm-searchable-snapshot.md) using `force_merge_index` are performed in the phase that the index is in **prior** to the `searchable_snapshot` action. You may want to explicitly choose in which data tier the force merge should occur, for example:
29+
* A force merge in the `hot` phase will use hot nodes. Merges may be faster on this potentially higher performance hardware but may have the tradeoff of impacting ingestion.
30+
* A force merge in the `warm` phase will use warm nodes. Merges may take longer to perform on potentially lower performance hardware but will avoid impacting ingestion in the `hot` tier.
31+
* [{{ilm-init}} Searchable Snapshot](./ilm-searchable-snapshot.md) performance is dependant upon the shard having been force merged, so by default this ILM action will enable `force_merge_index`. This will trigger force merges in the preceding node data tier for `cold` and `frozen` phases.
3032

31-
Force merging will be performed by the nodes within the current phase of the index. A forcemerge in the `hot` phase will use hot nodes with potentially faster nodes, while impacting ingestion more. A forcemerge in the `warm` phase will use warm nodes and potentially take longer to perform, but without impacting ingestion in the `hot` tier.
32-
33+
We recommend that merges be targetted against SSD and not HDD disks.
3334
:::::
3435

3536

modules/ingest-geoip/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.elasticsearch.gradle.OS
1212
apply plugin: 'elasticsearch.internal-yaml-rest-test'
1313
apply plugin: 'elasticsearch.yaml-rest-compat-test'
1414
apply plugin: 'elasticsearch.internal-cluster-test'
15+
apply plugin: 'elasticsearch.internal-test-artifact'
1516

1617
esplugin {
1718
description = 'Ingest processor that uses lookup geo data based on IP addresses using the MaxMind geo database'

modules/ingest-geoip/qa/multi-project/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,25 @@
88
*/
99

1010
apply plugin: 'elasticsearch.internal-java-rest-test'
11+
apply plugin: 'elasticsearch.internal-yaml-rest-test'
1112

1213
dependencies {
1314
javaRestTestImplementation project(':modules:ingest-geoip')
1415
javaRestTestImplementation project(':test:external-modules:test-multi-project')
1516
javaRestTestImplementation project(':test:fixtures:geoip-fixture')
1617

18+
yamlRestTestImplementation(testArtifact(project(":modules:ingest-geoip"), "yamlRestTest")) // includes yaml test code from ingest-geoip
19+
yamlRestTestImplementation project(':modules:ingest-geoip')
20+
yamlRestTestImplementation project(':test:external-modules:test-multi-project')
21+
yamlRestTestImplementation project(':test:fixtures:geoip-fixture')
22+
yamlRestTestImplementation project(':x-pack:qa:multi-project:yaml-test-framework')
23+
1724
clusterModules project(':modules:ingest-geoip')
1825
clusterModules project(':modules:reindex') // needed for database cleanup
1926
clusterModules project(':test:external-modules:test-multi-project')
27+
28+
// includes yaml rest test artifacts from ingest-geoip module
29+
restTestConfig project(path: ':modules:ingest-geoip', configuration: "restTests")
2030
}
2131

2232
tasks.withType(Test).configureEach {
@@ -27,3 +37,10 @@ tasks.withType(Test).configureEach {
2737
tasks.named { it == "javaRestTest" || it == "yamlRestTest" }.configureEach {
2838
it.onlyIf("snapshot build") { buildParams.snapshotBuild }
2939
}
40+
41+
restResources {
42+
restTests {
43+
// includes yaml rest test from ingest_geoip folder
44+
includeCore 'ingest_geoip'
45+
}
46+
}

modules/ingest-geoip/qa/multi-project/src/javaRestTest/java/geoip/GeoIpMultiProjectIT.java renamed to modules/ingest-geoip/qa/multi-project/src/javaRestTest/java/org/elasticsearch/ingest/geoip/GeoIpMultiProjectIT.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
package geoip;
10+
package org.elasticsearch.ingest.geoip;
1111

1212
import fixture.geoip.GeoIpHttpFixture;
1313

1414
import org.elasticsearch.client.Request;
1515
import org.elasticsearch.client.RequestOptions;
1616
import org.elasticsearch.core.Booleans;
17-
import org.elasticsearch.ingest.geoip.GeoIpDownloader;
18-
import org.elasticsearch.ingest.geoip.GeoIpDownloaderTaskExecutor;
1917
import org.elasticsearch.tasks.Task;
2018
import org.elasticsearch.test.cluster.ElasticsearchCluster;
2119
import org.elasticsearch.test.rest.ESRestTestCase;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.ingest.geoip;
11+
12+
import fixture.geoip.GeoIpHttpFixture;
13+
14+
import com.carrotsearch.randomizedtesting.annotations.Name;
15+
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
16+
17+
import org.elasticsearch.core.Booleans;
18+
import org.elasticsearch.core.FixForMultiProject;
19+
import org.elasticsearch.multiproject.test.MultipleProjectsClientYamlSuiteTestCase;
20+
import org.elasticsearch.test.cluster.ElasticsearchCluster;
21+
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
22+
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
23+
import org.junit.Before;
24+
import org.junit.ClassRule;
25+
import org.junit.rules.RuleChain;
26+
import org.junit.rules.TestRule;
27+
28+
import static org.elasticsearch.ingest.geoip.IngestGeoIpClientYamlTestSuiteIT.assertDatabasesLoaded;
29+
import static org.elasticsearch.ingest.geoip.IngestGeoIpClientYamlTestSuiteIT.putGeoipPipeline;
30+
31+
@FixForMultiProject(description = "Potentially remove this test after https://elasticco.atlassian.net/browse/ES-12094 is implemented")
32+
public class IngestGeoIpClientMultiProjectYamlTestSuiteIT extends MultipleProjectsClientYamlSuiteTestCase {
33+
34+
private static final boolean useFixture = Booleans.parseBoolean(System.getProperty("geoip_use_service", "false")) == false;
35+
36+
private static GeoIpHttpFixture fixture = new GeoIpHttpFixture(useFixture);
37+
38+
private static ElasticsearchCluster cluster = ElasticsearchCluster.local()
39+
.module("reindex")
40+
.module("ingest-geoip")
41+
.systemProperty("ingest.geoip.downloader.enabled.default", "true")
42+
// sets the plain (geoip.elastic.co) downloader endpoint, which is used in these tests
43+
.setting("ingest.geoip.downloader.endpoint", () -> fixture.getAddress(), s -> useFixture)
44+
// also sets the enterprise downloader maxmind endpoint, to make sure we do not accidentally hit the real endpoint from tests
45+
// note: it's not important that the downloading actually work at this point -- the rest tests (so far) don't exercise
46+
// the downloading code because of license reasons -- but if they did, then it would be important that we're hitting a fixture
47+
.systemProperty("ingest.geoip.downloader.maxmind.endpoint.default", () -> fixture.getAddress(), s -> useFixture)
48+
.setting("test.multi_project.enabled", "true")
49+
.setting("xpack.license.self_generated.type", "trial")
50+
.user(USER, PASS)
51+
.build();
52+
53+
@ClassRule
54+
public static TestRule ruleChain = RuleChain.outerRule(fixture).around(cluster);
55+
56+
@Override
57+
protected String getTestRestCluster() {
58+
return cluster.getHttpAddresses();
59+
}
60+
61+
public IngestGeoIpClientMultiProjectYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
62+
super(testCandidate);
63+
}
64+
65+
@ParametersFactory
66+
public static Iterable<Object[]> parameters() throws Exception {
67+
return ESClientYamlSuiteTestCase.createParameters();
68+
}
69+
70+
@Before
71+
public void waitForDatabases() throws Exception {
72+
putGeoipPipeline("pipeline-with-geoip");
73+
assertDatabasesLoaded();
74+
}
75+
}

0 commit comments

Comments
 (0)