mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Some steps, such as steps that delete, close, or freeze an index, may fail due to a currently running snapshot of the index. In those cases, rather than move to the ERROR step, we should retry the step when the snapshot has completed. This change adds an abstract step (`AsyncRetryDuringSnapshotActionStep`) that certain steps (like the ones I mentioned above) can extend that will automatically handle a situation where a snapshot is taking place. When a `SnapshotInProgressException` is received by the listener wrapper, a `ClusterStateObserver` listener is registered to wait until the snapshot has completed, re-running the ILM action when no snapshot is occurring. This also adds integration tests for these scenarios (thanks to @talevy in #37552). Resolves #37541
61 lines
2.1 KiB
Groovy
61 lines
2.1 KiB
Groovy
import org.elasticsearch.gradle.test.RestIntegTestTask
|
|
|
|
apply plugin: 'elasticsearch.standalone-test'
|
|
|
|
dependencies {
|
|
testCompile project(':x-pack:plugin:ccr:qa')
|
|
testCompile project(':x-pack:plugin:core')
|
|
testCompile project(':x-pack:plugin:ilm')
|
|
}
|
|
|
|
task leaderClusterTest(type: RestIntegTestTask) {
|
|
mustRunAfter(precommit)
|
|
}
|
|
|
|
leaderClusterTestCluster {
|
|
numNodes = 1
|
|
clusterName = 'leader-cluster'
|
|
setting 'xpack.ilm.enabled', 'true'
|
|
setting 'xpack.ccr.enabled', 'true'
|
|
setting 'xpack.security.enabled', 'false'
|
|
setting 'xpack.watcher.enabled', 'false'
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
setting 'xpack.ml.enabled', 'false'
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
setting 'indices.lifecycle.poll_interval', '1000ms'
|
|
}
|
|
|
|
leaderClusterTestRunner {
|
|
systemProperty 'tests.target_cluster', 'leader'
|
|
/* To support taking index snapshots, we have to set path.repo setting */
|
|
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
|
}
|
|
|
|
task followClusterTest(type: RestIntegTestTask) {}
|
|
|
|
followClusterTestCluster {
|
|
dependsOn leaderClusterTestRunner
|
|
numNodes = 1
|
|
clusterName = 'follow-cluster'
|
|
setting 'xpack.ilm.enabled', 'true'
|
|
setting 'xpack.ccr.enabled', 'true'
|
|
setting 'xpack.security.enabled', 'false'
|
|
setting 'xpack.watcher.enabled', 'false'
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
setting 'xpack.ml.enabled', 'false'
|
|
setting 'xpack.license.self_generated.type', 'trial'
|
|
setting 'indices.lifecycle.poll_interval', '1000ms'
|
|
setting 'cluster.remote.leader_cluster.seeds', "\"${-> leaderClusterTest.nodes.get(0).transportUri()}\""
|
|
}
|
|
|
|
followClusterTestRunner {
|
|
systemProperty 'tests.target_cluster', 'follow'
|
|
systemProperty 'tests.leader_host', "${-> leaderClusterTest.nodes.get(0).httpUri()}"
|
|
/* To support taking index snapshots, we have to set path.repo setting */
|
|
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
|
|
finalizedBy 'leaderClusterTestCluster#stop'
|
|
}
|
|
|
|
check.dependsOn followClusterTest
|
|
unitTest.enabled = false // no unit tests for this module, only the rest integration test
|