Skip to content

Commit 2ed8e16

Browse files
authored
Reenable SearchableSnapshotsRollingUpgradeIT (#69788)
The test SearchableSnapshotsRollingUpgradeIT caused CI failures at least two times (#69705) since it was merged into master. After looking at all node logs, I wasn't able to determine precisely the cause of the test suite timeout. After looking at the code I think it is preferable to use a dedicated path.repo for this test so that it does not interfere with existing and future tests that could wipe the repositories and snapshots of the default path.repo at any time. I also fixed an issue with the storage paramater that should only work starting 7.12.0. Finally, #69704 has been merged and it should provide more nformation if this test fails again. Closes #69705
1 parent fe6f50e commit 2ed8e16

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

x-pack/qa/rolling-upgrade/build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ tasks.register("copyTestNodeKeyMaterial", Copy) {
3333

3434
for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
3535
String baseName = "v${bwcVersion}"
36-
String repositoryPath = "${buildDir}/cluster/shared/repo/${baseName}"
36+
37+
// SearchableSnapshotsRollingUpgradeIT uses a specific repository to not interfere with other tests
38+
String searchableSnapshotRepository = "${buildDir}/cluster/shared/searchable-snapshots-repo/${baseName}"
3739

3840
testClusters {
3941
"${baseName}" {
@@ -42,7 +44,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
4244
numberOfNodes = 3
4345

4446
setting 'repositories.url.allowed_urls', 'http://snapshot.test*'
45-
setting 'path.repo', repositoryPath
47+
setting 'path.repo', "[ \"${buildDir}/cluster/shared/repo/${baseName}\", \"${searchableSnapshotRepository}\" ]"
4648
setting 'xpack.license.self_generated.type', 'trial'
4749
setting 'xpack.security.enabled', 'true'
4850
setting 'xpack.security.transport.ssl.enabled', 'true'
@@ -94,7 +96,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
9496
dependsOn "copyTestNodeKeyMaterial"
9597
systemProperty 'tests.rest.suite', 'old_cluster'
9698
systemProperty 'tests.upgrade_from_version', version.toString().replace('-SNAPSHOT', '')
97-
systemProperty 'tests.path.repo', repositoryPath
99+
systemProperty 'tests.path.searchable.snapshots.repo', searchableSnapshotRepository
98100
nonInputProperties.systemProperty('tests.rest.cluster', "${-> testClusters."${baseName}".allHttpSocketURI.join(",")}")
99101
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
100102
}
@@ -111,7 +113,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
111113
systemProperty 'tests.rest.suite', 'mixed_cluster'
112114
systemProperty 'tests.first_round', 'true'
113115
systemProperty 'tests.upgrade_from_version', oldVersion
114-
systemProperty 'tests.path.repo', repositoryPath
116+
systemProperty 'tests.path.searchable.snapshots.repo', searchableSnapshotRepository
115117
// We only need to run these tests once so we may as well do it when we're two thirds upgraded
116118
systemProperty 'tests.rest.blacklist', [
117119
'mixed_cluster/10_basic/Start scroll in mixed cluster on upgraded node that we will continue after upgrade',
@@ -137,7 +139,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
137139
systemProperty 'tests.rest.suite', 'mixed_cluster'
138140
systemProperty 'tests.first_round', 'false'
139141
systemProperty 'tests.upgrade_from_version', oldVersion
140-
systemProperty 'tests.path.repo', repositoryPath
142+
systemProperty 'tests.path.searchable.snapshots.repo', searchableSnapshotRepository
141143
}
142144

143145
tasks.register("${baseName}#upgradedClusterTest", StandaloneRestIntegTestTask) {
@@ -150,7 +152,7 @@ for (Version bwcVersion : BuildParams.bwcVersions.wireCompatible) {
150152
nonInputProperties.systemProperty('tests.clustername', "${-> testClusters."${baseName}".getName()}")
151153
systemProperty 'tests.rest.suite', 'upgraded_cluster'
152154
systemProperty 'tests.upgrade_from_version', oldVersion
153-
systemProperty 'tests.path.repo', repositoryPath
155+
systemProperty 'tests.path.searchable.snapshots.repo', searchableSnapshotRepository
154156
}
155157

156158
tasks.register(bwcTaskName(bwcVersion)) {

x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/SearchableSnapshotsRollingUpgradeIT.java

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.apache.http.client.methods.HttpGet;
1212
import org.apache.http.client.methods.HttpPost;
1313
import org.apache.http.client.methods.HttpPut;
14-
import org.apache.lucene.util.LuceneTestCase;
1514
import org.elasticsearch.Version;
1615
import org.elasticsearch.client.Request;
1716
import org.elasticsearch.client.Response;
@@ -34,7 +33,6 @@
3433
import static org.hamcrest.Matchers.equalTo;
3534
import static org.hamcrest.Matchers.notNullValue;
3635

37-
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/69705")
3836
public class SearchableSnapshotsRollingUpgradeIT extends AbstractUpgradeTestCase {
3937

4038
public void testMountFullCopyAndRecoversCorrectly() throws Exception {
@@ -56,18 +54,16 @@ public void testMountPartialCopyAndRecoversCorrectly() throws Exception {
5654
*/
5755
private void executeMountAndRecoversCorrectlyTestCase(Storage storage, long numberOfDocs) throws Exception {
5856
final String suffix = storage.storageName().toLowerCase(Locale.ROOT);
57+
final String repository = "repository_" + suffix;
58+
final String snapshot = "snapshot_" + suffix;
5959
final String index = "mounted_index_" + suffix;
6060

6161
if (CLUSTER_TYPE.equals(ClusterType.OLD)) {
62-
final String repository = "repository_" + suffix;
63-
final String snapshot = "snapshot_" + suffix;
64-
65-
registerRepository(repository, FsRepository.TYPE, true,
66-
Settings.builder().put("location", System.getProperty("tests.path.repo") + '/' + repository).build());
62+
registerRepository(repository, FsRepository.TYPE, true, repositorySettings(repository));
6763

6864
final String originalIndex = "logs_" + suffix;
6965
createIndex(originalIndex, Settings.builder()
70-
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(3, 5))
66+
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 3))
7167
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
7268
.build());
7369
indexDocs(originalIndex, numberOfDocs);
@@ -81,6 +77,12 @@ private void executeMountAndRecoversCorrectlyTestCase(Storage storage, long numb
8177

8278
ensureGreen(index);
8379
assertHitCount(index, equalTo(numberOfDocs));
80+
81+
if (CLUSTER_TYPE.equals(ClusterType.UPGRADED)) {
82+
deleteIndex(index);
83+
deleteSnapshot(repository, snapshot);
84+
deleteRepository(repository);
85+
}
8486
}
8587

8688
public void testBlobStoreCacheWithFullCopyInMixedVersions() throws Exception {
@@ -107,8 +109,7 @@ private void executeBlobCacheCreationTestCase(Storage storage, long numberOfDocs
107109
final String repository = "repository_" + suffix;
108110

109111
if (CLUSTER_TYPE.equals(ClusterType.OLD)) {
110-
registerRepository(repository, FsRepository.TYPE, true,
111-
Settings.builder().put("location", System.getProperty("tests.path.repo") + '/' + repository).build());
112+
registerRepository(repository, FsRepository.TYPE, true, repositorySettings(repository));
112113

113114
} else if (CLUSTER_TYPE.equals(ClusterType.MIXED)) {
114115
final int numberOfNodes = 3;
@@ -135,7 +136,7 @@ private void executeBlobCacheCreationTestCase(Storage storage, long numberOfDocs
135136

136137
final String firstIndex = "first_index_" + suffix;
137138
createIndex(firstIndex, Settings.builder()
138-
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(3, 5))
139+
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, randomIntBetween(1, 3))
139140
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
140141
.build());
141142
indexDocs(firstIndex, numberOfDocs);
@@ -287,8 +288,11 @@ private static void mountSnapshot(
287288
Settings indexSettings
288289
) throws IOException {
289290
final Request request = new Request(HttpPost.METHOD_NAME, "/_snapshot/" + repositoryName + '/' + snapshotName + "/_mount");
290-
request.addParameter("storage", storage.storageName());
291-
request.addParameter("wait_for_completion", "true");
291+
if (UPGRADE_FROM_VERSION.onOrAfter(Version.V_7_12_0)) {
292+
request.addParameter("storage", storage.storageName());
293+
} else {
294+
assertThat("Parameter 'storage' was introduced in 7.12.0 with " + Storage.SHARED_CACHE, storage, equalTo(Storage.FULL_COPY));
295+
}
292296
request.setJsonEntity("{" +
293297
" \"index\": \"" + indexName + "\"," +
294298
" \"renamed_index\": \"" + renamedIndex + "\"," +
@@ -311,4 +315,12 @@ private static void assertHitCount(String indexName, Matcher<Long> countMatcher)
311315
assertThat(((Number) extractValue("count", responseAsMap)).longValue(), countMatcher);
312316
assertThat(((Number) extractValue("_shards.failed", responseAsMap)).intValue(), equalTo(0));
313317
}
318+
319+
private static Settings repositorySettings(String repository) {
320+
final String pathRepo = System.getProperty("tests.path.searchable.snapshots.repo");
321+
assertThat("Searchable snapshots repository path is null", pathRepo, notNullValue());
322+
return Settings.builder()
323+
.put("location", pathRepo + '/' + repository)
324+
.build();
325+
}
314326
}

0 commit comments

Comments
 (0)