Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

Commit 2ae4247

Browse files
Adds support for ES 7.8.0 (#219)
* Adds support for ES 7.8.0 * Adds support for ES 7.8.0: minor cleanup and added release-notes * Adds support for ES 7.8.0: removed extra newlines * Adds support for ES 7.8.0: removed extra ?
1 parent 5429e76 commit 2ae4247

File tree

11 files changed

+29
-20
lines changed

11 files changed

+29
-20
lines changed

alerting/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ dependencies {
8383
javadoc.enabled = false // turn off javadoc as it barfs on Kotlin code
8484
licenseHeaders.enabled = true
8585
dependencyLicenses.enabled = false
86+
// no need to validate pom, as this project is not uploaded to sonatype
87+
validateNebulaPom.enabled = false
8688
thirdPartyAudit.enabled = false
8789

8890
def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile

alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/AlertingPlugin.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import org.elasticsearch.painless.spi.WhitelistLoader
5757
import org.elasticsearch.plugins.ActionPlugin
5858
import org.elasticsearch.plugins.Plugin
5959
import org.elasticsearch.plugins.ScriptPlugin
60+
import org.elasticsearch.repositories.RepositoriesService
6061
import org.elasticsearch.rest.RestController
6162
import org.elasticsearch.rest.RestHandler
6263
import org.elasticsearch.script.ScriptContext
@@ -131,7 +132,8 @@ internal class AlertingPlugin : PainlessExtension, ActionPlugin, ScriptPlugin, P
131132
environment: Environment,
132133
nodeEnvironment: NodeEnvironment,
133134
namedWriteableRegistry: NamedWriteableRegistry,
134-
indexNameExpressionResolver: IndexNameExpressionResolver
135+
indexNameExpressionResolver: IndexNameExpressionResolver,
136+
repositoriesServiceSupplier: Supplier<RepositoriesService>
135137
): Collection<Any> {
136138
// Need to figure out how to use the Elasticsearch DI classes rather than handwiring things here.
137139
val settings = environment.settings()

alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/alerts/AlertIndices.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class AlertIndices(
158158
override fun clusterChanged(event: ClusterChangedEvent) {
159159
// if the indexes have been deleted they need to be reinitalized
160160
alertIndexInitialized = event.state().routingTable().hasIndex(ALERT_INDEX)
161-
historyIndexInitialized = event.state().metaData().hasAlias(HISTORY_WRITE_INDEX)
161+
historyIndexInitialized = event.state().metadata().hasAlias(HISTORY_WRITE_INDEX)
162162
}
163163

164164
private fun rescheduleRollover() {
@@ -265,7 +265,7 @@ class AlertIndices(
265265
.settings(Settings.builder().put("index.hidden", true).build())
266266
request.addMaxIndexDocsCondition(historyMaxDocs)
267267
request.addMaxIndexAgeCondition(historyMaxAge)
268-
val response = client.admin().indices().rolloversIndex(request).actionGet(requestTimeout)
268+
val response = client.admin().indices().rolloverIndex(request).actionGet(requestTimeout)
269269
if (!response.isRolledOver) {
270270
logger.info("$HISTORY_WRITE_INDEX not rolled over. Conditions were: ${response.conditionStatus}")
271271
} else {
@@ -280,13 +280,13 @@ class AlertIndices(
280280
val clusterStateRequest = ClusterStateRequest()
281281
.clear()
282282
.indices(HISTORY_ALL)
283-
.metaData(true)
283+
.metadata(true)
284284
.local(true)
285285
.indicesOptions(IndicesOptions.strictExpand())
286286

287287
val clusterStateResponse = client.admin().cluster().state(clusterStateRequest).actionGet()
288288

289-
for (entry in clusterStateResponse.state.metaData.indices) {
289+
for (entry in clusterStateResponse.state.metadata.indices) {
290290
val indexMetaData = entry.value
291291
val creationTime = indexMetaData.creationDate
292292

alerting/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtils.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest
2222
import org.elasticsearch.action.support.master.AcknowledgedResponse
2323
import org.elasticsearch.client.IndicesAdminClient
2424
import org.elasticsearch.cluster.ClusterState
25-
import org.elasticsearch.cluster.metadata.IndexMetaData
25+
import org.elasticsearch.cluster.metadata.IndexMetadata
2626
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler
2727
import org.elasticsearch.common.xcontent.NamedXContentRegistry
2828
import org.elasticsearch.common.xcontent.XContentParser
@@ -92,11 +92,11 @@ class IndexUtils {
9292

9393
@JvmStatic
9494
fun getIndexNameWithAlias(clusterState: ClusterState, alias: String): String {
95-
return clusterState.metaData.indices.first { it.value.aliases.containsKey(alias) }.key
95+
return clusterState.metadata.indices.first { it.value.aliases.containsKey(alias) }.key
9696
}
9797

9898
@JvmStatic
99-
fun shouldUpdateIndex(index: IndexMetaData, mapping: String): Boolean {
99+
fun shouldUpdateIndex(index: IndexMetadata, mapping: String): Boolean {
100100
var oldVersion = NO_SCHEMA_VERSION
101101
val newVersion = getSchemaVersion(mapping)
102102

@@ -119,8 +119,8 @@ class IndexUtils {
119119
client: IndicesAdminClient,
120120
actionListener: ActionListener<AcknowledgedResponse>
121121
) {
122-
if (clusterState.metaData.indices.containsKey(index)) {
123-
if (shouldUpdateIndex(clusterState.metaData.indices[index], mapping)) {
122+
if (clusterState.metadata.indices.containsKey(index)) {
123+
if (shouldUpdateIndex(clusterState.metadata.indices[index], mapping)) {
124124
val putMappingRequest: PutMappingRequest = PutMappingRequest(index).type(type).source(mapping, XContentType.JSON)
125125
client.putMapping(putMappingRequest, actionListener)
126126
} else {

alerting/src/test/kotlin/com/amazon/opendistroforelasticsearch/alerting/util/IndexUtilsTests.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.amazon.opendistroforelasticsearch.alerting.util
1717

1818
import com.amazon.opendistroforelasticsearch.alerting.parser
19-
import org.elasticsearch.cluster.metadata.IndexMetaData
19+
import org.elasticsearch.cluster.metadata.IndexMetadata
2020
import org.elasticsearch.test.ESTestCase
2121
import java.lang.NumberFormatException
2222
import kotlin.test.assertFailsWith
@@ -66,7 +66,7 @@ class IndexUtilsTests : ESTestCase() {
6666
"\"version\":{\"created\":\"6040399\"},\"provided_name\":\"data_test\"}},\"mapping_version\":123," +
6767
"\"settings_version\":123,\"mappings\":{\"_doc\":{\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}}"
6868
val newMapping = "{\"_meta\":{\"schema_version\":10},\"properties\":{\"name\":{\"type\":\"keyword\"}}}"
69-
val index: IndexMetaData = IndexMetaData.fromXContent(parser(indexContent))
69+
val index: IndexMetadata = IndexMetadata.fromXContent(parser(indexContent))
7070

7171
val shouldUpdateIndex = IndexUtils.shouldUpdateIndex(index, newMapping)
7272
assertTrue(shouldUpdateIndex)
@@ -79,7 +79,7 @@ class IndexUtilsTests : ESTestCase() {
7979
"\"settings_version\":123,\"mappings\":{\"_doc\":{\"_meta\":{\"schema_version\":1},\"properties\":" +
8080
"{\"name\":{\"type\":\"keyword\"}}}}}}"
8181
val newMapping = "{\"_meta\":{\"schema_version\":10},\"properties\":{\"name\":{\"type\":\"keyword\"}}}"
82-
val index: IndexMetaData = IndexMetaData.fromXContent(parser(indexContent))
82+
val index: IndexMetadata = IndexMetadata.fromXContent(parser(indexContent))
8383

8484
val shouldUpdateIndex = IndexUtils.shouldUpdateIndex(index, newMapping)
8585
assertTrue(shouldUpdateIndex)
@@ -91,7 +91,7 @@ class IndexUtilsTests : ESTestCase() {
9191
"\"version\":{\"created\":\"6040399\"},\"provided_name\":\"data_test\"}},\"mappings\":" +
9292
"{\"_doc\":{\"_meta\":{\"schema_version\":1},\"properties\":{\"name\":{\"type\":\"keyword\"}}}}}}"
9393
val newMapping = "{\"_meta\":{\"schema_version\":1},\"properties\":{\"name\":{\"type\":\"keyword\"}}}"
94-
val index: IndexMetaData = IndexMetaData.fromXContent(parser(indexContent))
94+
val index: IndexMetadata = IndexMetadata.fromXContent(parser(indexContent))
9595

9696
val shouldUpdateIndex = IndexUtils.shouldUpdateIndex(index, newMapping)
9797
assertFalse(shouldUpdateIndex)

build-tools/esplugin-coverage.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ integTest.runner {
5656
}
5757

5858
testClusters.integTest {
59-
jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}"
59+
//Hack: to fix jacocoagent path with gradle 6.5, add the missing "/" at the start of the jacocoagent path.
60+
jvmArgs " ${dummyIntegTest.jacoco.getAsJvmArg()}".replace('javaagent:','javaagent:/')
6061
systemProperty 'com.sun.management.jmxremote', "true"
6162
systemProperty 'com.sun.management.jmxremote.authenticate', "false"
6263
systemProperty 'com.sun.management.jmxremote.port', "7777"

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ buildscript {
1717
apply from: 'build-tools/repositories.gradle'
1818

1919
ext {
20-
es_version = '7.7.0'
20+
es_version = '7.8.0'
2121
kotlin_version = '1.3.21'
2222
}
2323

@@ -42,7 +42,7 @@ apply plugin: 'jacoco'
4242
apply from: 'build-tools/merged-coverage.gradle'
4343

4444
ext {
45-
opendistroVersion = '1.8.0'
45+
opendistroVersion = '1.9.0'
4646
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
4747
}
4848

core/src/main/kotlin/com/amazon/opendistroforelasticsearch/alerting/core/ScheduledJobIndices.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ScheduledJobIndices(private val client: AdminClient, private val clusterSe
6767

6868
if (scheduledJobIndexExists()) {
6969
val indexRoutingTable = clusterService.state().routingTable.index(ScheduledJob.SCHEDULED_JOBS_INDEX)
70-
val indexMetaData = clusterService.state().metaData().index(ScheduledJob.SCHEDULED_JOBS_INDEX)
70+
val indexMetaData = clusterService.state().metadata().index(ScheduledJob.SCHEDULED_JOBS_INDEX)
7171

7272
indexHealth = ClusterIndexHealth(indexMetaData, indexRoutingTable)
7373
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

notification/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ publishing {
8585
repositories {
8686
maven {
8787
name = "sonatype-staging"
88-
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
88+
url "https://aws.oss.sonatype.org/service/local/staging/deploy/maven2"
8989
credentials {
9090
username project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : ''
9191
password project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ''
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## 2020-06-24, Version 1.9.0.0
2+
3+
### New Features
4+
* Adds support for Elasticsearch 7.8.0 - [PR #219](https://github.com/opendistro-for-elasticsearch/alerting/pull/219)

0 commit comments

Comments
 (0)