Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for .watches that wasn't upgraded properly #39609

Merged
merged 1 commit into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ static DeprecationIssue oldIndicesCheck(IndexMetaData indexMetaData) {
"The .tasks index was created before version 6.0 and cannot be opened in 7.0. " +
"You must delete this index and allow it to be re-created by Elasticsearch. If you wish to preserve task history, "+
"reindex this index to a new index before deleting it.");
} else if (".watches".equals(indexMetaData.getIndex().getName())) {
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
".watches was not properly upgraded before upgrading to Elasticsearch 6",
"https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html",
"The .watches index was created before version 6.0, and was not properly upgraded in 5.6. " +
"Please upgrade this index using the Migration Upgrade API.");
}
if ((mappingCount == 2 && !hasDefaultMapping)
|| mappingCount > 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ public void testOldTasksIndexCheck() {
assertEquals(singletonList(expected), issues);
}

public void testUnupgradedWatcherIndexCheck() {
Version createdWith = VersionUtils.randomVersionBetween(random(), Version.V_5_0_0,
VersionUtils.getPreviousVersion(Version.V_6_0_0));
IndexMetaData indexMetaData = IndexMetaData.builder(".watches")
.settings(settings(createdWith))
.numberOfShards(1)
.numberOfReplicas(0)
.build();
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
".watches was not properly upgraded before upgrading to Elasticsearch 6",
"https://www.elastic.co/guide/en/elasticsearch/reference/current/migration-api-upgrade.html",
"The .watches index was created before version 6.0, and was not properly upgraded in 5.6. " +
"Please upgrade this index using the Migration Upgrade API.");
List<DeprecationIssue> issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(indexMetaData));
assertEquals(singletonList(expected), issues);
}

public void testMultipleTypesCheckWithDefaultMapping() throws IOException {
String mappingName1 = randomAlphaOfLengthBetween(2, 5);
String mappingJson1 = "{\n" +
Expand Down