Skip to content

Commit

Permalink
1. Porting additional check in rollover step that is missing in githu…
Browse files Browse the repository at this point in the history
…b 2. Minor optimization, converting to set 3. Updating schema version

Signed-off-by: Ravi Thaluru <thalurur@users.noreply.github.com>
  • Loading branch information
thalurur committed Apr 25, 2022
1 parent 534bb10 commit f2ede10
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class ManagedIndexCoordinator(
val deletedIndices = event.indicesDeleted().map { it.name }
val allIndicesUuid = indexMetadataProvider.getMultiTypeISMIndexMetadata(indexNames = deletedIndices).map { (_, metadataMapForType) ->
metadataMapForType.values.map { it.indexUuid }
}.flatten()
}.flatten().toSet()
// Check if the deleted index uuid is still part of any metadata service in the cluster and has an existing managed index job
indicesToClean = event.indicesDeleted().filter { it.uuid in managedIndices.keys && !allIndicesUuid.contains(it.uuid) }
removeManagedIndexReq = indicesToClean.map { deleteManagedIndexRequest(it.uuid) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ class AttemptRolloverStep(private val action: RolloverAction) : Step(name) {
return this
}

// If we have already rolled over this index then fail as we only allow an index to be rolled over once
if (context.metadata.rolledOver == true) {
logger.warn("$indexName was already rolled over, cannot execute rollover step")
stepStatus = StepStatus.FAILED
info = mapOf("message" to getFailedDuplicateRolloverMessage(indexName))
return this
}

val (rolloverTarget, isDataStream) = getRolloverTargetOrUpdateInfo(context)
// If the rolloverTarget is null, we would've already updated the failed info from getRolloverTargetOrUpdateInfo and can return early
rolloverTarget ?: return this
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mappings/opendistro-ism-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_meta" : {
"schema_version": 14
"schema_version": 15
},
"dynamic": "strict",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import javax.management.remote.JMXServiceURL

abstract class IndexManagementRestTestCase : ODFERestTestCase() {

val configSchemaVersion = 14
val configSchemaVersion = 15
val historySchemaVersion = 5

// Having issues with tests leaking into other tests and mappings being incorrect and they are not caught by any pending task wait check as
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"_meta" : {
"schema_version": 14
"schema_version": 15
},
"dynamic": "strict",
"properties": {
Expand Down

0 comments on commit f2ede10

Please sign in to comment.