Skip to content
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 @@ -474,7 +474,7 @@ class AlertIndices(
clusterStateRequest,
object : ActionListener<ClusterStateResponse> {
override fun onResponse(clusterStateResponse: ClusterStateResponse) {
if (!clusterStateResponse.state.metadata.indices.isEmpty) {
if (!clusterStateResponse.state.metadata.indices.isEmpty()) {
val indicesToDelete = getIndicesToDelete(clusterStateResponse)
logger.info("Deleting old $tag indices viz $indicesToDelete")
deleteAllOldHistoryIndices(indicesToDelete)
Expand Down Expand Up @@ -509,7 +509,7 @@ class AlertIndices(
): String? {
val creationTime = indexMetadata.creationDate
if ((Instant.now().toEpochMilli() - creationTime) > retentionPeriodMillis) {
val alias = indexMetadata.aliases.firstOrNull { writeIndex == it.value.alias }
val alias = indexMetadata.aliases.entries.firstOrNull { writeIndex == it.value.alias }
if (alias != null) {
if (historyEnabled) {
// If the index has the write alias and history is enabled, don't delete the index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class IndexUtils {

@JvmStatic
fun getIndexNameWithAlias(clusterState: ClusterState, alias: String): String {
return clusterState.metadata.indices.first { it.value.aliases.containsKey(alias) }.key
return clusterState.metadata.indices.entries.first { it.value.aliases.containsKey(alias) }.key
}

@JvmStatic
Expand All @@ -126,7 +126,7 @@ class IndexUtils {
actionListener: ActionListener<AcknowledgedResponse>
) {
if (clusterState.metadata.indices.containsKey(index)) {
if (shouldUpdateIndex(clusterState.metadata.indices[index], mapping)) {
if (shouldUpdateIndex(clusterState.metadata.indices[index]!!, mapping)) {
val putMappingRequest: PutMappingRequest = PutMappingRequest(index).source(mapping, XContentType.JSON)
client.putMapping(putMappingRequest, actionListener)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ abstract class AlertingSingleNodeTestCase : OpenSearchSingleNodeTestCase() {

protected fun assertAliasNotExists(alias: String) {
val aliasesResponse = client().admin().indices().getAliases(GetAliasesRequest()).get()
val foundAlias = aliasesResponse.aliases.values().forEach {
it.value.forEach {
if (it.alias == alias) {
val foundAlias = aliasesResponse.aliases.values.forEach {
it.forEach { it1 ->
if (it1.alias == alias) {
fail("alias exists, but it shouldn't")
}
}
Expand All @@ -122,9 +122,9 @@ abstract class AlertingSingleNodeTestCase : OpenSearchSingleNodeTestCase() {

protected fun assertAliasExists(alias: String) {
val aliasesResponse = client().admin().indices().getAliases(GetAliasesRequest()).get()
val foundAlias = aliasesResponse.aliases.values().forEach {
it.value.forEach {
if (it.alias == alias) {
val foundAlias = aliasesResponse.aliases.values.forEach {
it.forEach { it1 ->
if (it1.alias == alias) {
return
}
}
Expand Down
22 changes: 7 additions & 15 deletions build-tools/merged-coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,18 @@ allprojects {
}
}

task jacocoMerge(type: JacocoMerge) {
task jacocoReport(type: JacocoReport, group: 'verification') {
description = 'Generates an aggregate report from all subprojects'
gradle.projectsEvaluated {
subprojects.each {
jacocoMerge.dependsOn it.tasks.withType(JacocoReport)
jacocoMerge.executionData it.tasks.withType(JacocoReport).collect { it.executionData }
subprojects.each {
jacocoReport.dependsOn it.tasks.withType(JacocoReport)
jacocoReport.executionData it.tasks.withType(JacocoReport).collect { it.executionData }
}
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}

task jacocoReport(type: JacocoReport, group: 'verification') {
description = 'Generates an aggregate report from all subprojects'
dependsOn jacocoMerge
executionData jacocoMerge.destinationFile

reports {
html.enabled = true // human readable
xml.enabled = true
html.required = true // human readable
xml.required = true
}

gradle.projectsEvaluated {
Expand Down
4 changes: 2 additions & 2 deletions build-tools/opensearchplugin-coverage.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ jacocoTestReport {
getSourceDirectories().from(sourceSets.main.allSource)
getClassDirectories().from(sourceSets.main.output)
reports {
html.enabled = true // human readable
xml.enabled = true // for coverlay
html.required = true // human readable
xml.required = true // for coverlay
}
}

Expand Down
14 changes: 6 additions & 8 deletions build-tools/pkgbuild.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'nebula.ospackage'
apply plugin: 'com.netflix.nebula.ospackage'

// This is afterEvaluate because the bundlePlugin ZIP task is updated afterEvaluate and changes the ZIP name to match the plugin name
afterEvaluate {
Expand All @@ -8,7 +8,7 @@ afterEvaluate {
version = "${project.version}" - "-SNAPSHOT"

into '/usr/share/opensearch/plugins'
from(zipTree(bundlePlugin.archivePath)) {
from(zipTree(bundlePlugin.archiveFile)) {
into opensearchplugin.name
}

Expand Down Expand Up @@ -39,9 +39,8 @@ afterEvaluate {
task renameRpm(type: Copy) {
from("$buildDir/distributions")
into("$buildDir/distributions")
include archiveName
rename archiveName, "${packageName}-${version}.rpm"
doLast { delete file("$buildDir/distributions/$archiveName") }
rename "$archiveFileName", "${packageName}-${archiveVersion}.rpm"
doLast { delete file("$buildDir/distributions/$archiveFileName") }
}
}

Expand All @@ -52,9 +51,8 @@ afterEvaluate {
task renameDeb(type: Copy) {
from("$buildDir/distributions")
into("$buildDir/distributions")
include archiveName
rename archiveName, "${packageName}-${version}.deb"
doLast { delete file("$buildDir/distributions/$archiveName") }
rename "$archiveFileName", "${packageName}-${archiveVersion}.deb"
doLast { delete file("$buildDir/distributions/$archiveFileName") }
}
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ buildscript {
}

plugins {
id 'nebula.ospackage' version "8.3.0" apply false
id 'com.netflix.nebula.ospackage' version "11.0.0"
id "com.dorongold.task-tree" version "1.5"
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
19 changes: 12 additions & 7 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.