Skip to content

Commit

Permalink
rollup upgrade issues fixes (opensearch-project#89)
Browse files Browse the repository at this point in the history
Signed-off-by: bowenlan-amzn <[email protected]>
  • Loading branch information
bowenlan-amzn authored Jun 30, 2021
1 parent 1bed719 commit 79fb1cb
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/multi-node-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
repository: 'opensearch-project/common-utils'
path: common-utils
ref: 'main'
ref: '1.0'
- name: Build common-utils
working-directory: ./common-utils
run: ./gradlew publishToMavenLocal -Dopensearch.version=1.0.0
Expand All @@ -46,7 +46,7 @@ jobs:
with:
repository: 'opensearch-project/job-scheduler'
path: job-scheduler
ref: 'main'
ref: '1.0'
- name: Build job-scheduler
working-directory: ./job-scheduler
run: ./gradlew publishToMavenLocal -Dopensearch.version=1.0.0 -Dbuild.snapshot=false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
repository: 'opensearch-project/common-utils'
path: common-utils
ref: 'main'
ref: '1.0'
- name: Build common-utils
working-directory: ./common-utils
run: ./gradlew publishToMavenLocal -Dopensearch.version=1.0.0
Expand All @@ -46,7 +46,7 @@ jobs:
with:
repository: 'opensearch-project/job-scheduler'
path: job-scheduler
ref: 'main'
ref: '1.0'
- name: Build job-scheduler
working-directory: ./job-scheduler
run: ./gradlew publishToMavenLocal -Dopensearch.version=1.0.0 -Dbuild.snapshot=false
Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ testClusters.integTest {
}))
}
setting 'path.repo', repo.absolutePath

if (System.getProperty("tests.clustername") != null) {
filter {
excludeTestsMatching "org.opensearch.indexmanagement.indexstatemanagement.MetadataRegressionIT"
}
}
}
integTest {
systemProperty 'tests.security.manager', 'false'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ class IndexManagementPlugin : JobSchedulerExtension, NetworkPlugin, ActionPlugin
.registerScriptService(scriptService)
.registerSettings(settings)
.registerConsumers() // registerConsumers must happen after registerSettings/clusterService
.registerIMIndex(indexManagementIndices)
.registerHistoryIndex(indexStateManagementHistory)
.registerSkipFlag(skipFlag)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ class ManagedIndexCoordinator(
@OpenForTesting
@Suppress("TooGenericExceptionCaught")
suspend fun clearManagedIndexMetaData(deleteRequests: List<DocWriteRequest<*>>) {
if (!ismIndices.indexManagementIndexExists()) return

try {
if (deleteRequests.isEmpty()) return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import org.opensearch.common.xcontent.XContentType
import org.opensearch.index.Index
import org.opensearch.index.engine.VersionConflictEngineException
import org.opensearch.index.seqno.SequenceNumbers
import org.opensearch.indexmanagement.IndexManagementIndices
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
import org.opensearch.indexmanagement.indexstatemanagement.action.Action
import org.opensearch.indexmanagement.indexstatemanagement.model.ManagedIndexConfig
Expand Down Expand Up @@ -130,6 +131,7 @@ object ManagedIndexRunner :
private lateinit var xContentRegistry: NamedXContentRegistry
private lateinit var scriptService: ScriptService
private lateinit var settings: Settings
private lateinit var imIndices: IndexManagementIndices
private lateinit var ismHistory: IndexStateManagementHistory
private lateinit var skipExecFlag: SkipExecution
private var indexStateManagementEnabled: Boolean = DEFAULT_ISM_ENABLED
Expand Down Expand Up @@ -189,6 +191,11 @@ object ManagedIndexRunner :
return this
}

fun registerIMIndex(imIndices: IndexManagementIndices): ManagedIndexRunner {
this.imIndices = imIndices
return this
}

fun registerHistoryIndex(ismHistory: IndexStateManagementHistory): ManagedIndexRunner {
this.ismHistory = ismHistory
return this
Expand Down Expand Up @@ -598,6 +605,10 @@ object ManagedIndexRunner :
lastUpdateResult: UpdateMetadataResult? = null
): UpdateMetadataResult {
var result = UpdateMetadataResult()
if (!imIndices.attemptUpdateConfigIndexMapping()) {
logger.error("Failed to update config index mapping.")
return result
}

var metadata: ManagedIndexMetaData = managedIndexMetaData
if (lastUpdateResult != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ data class ManagedIndexConfig(
policySeqNo = policySeqNo,
policyPrimaryTerm = policyPrimaryTerm,
policy = policy?.copy(
id = policyID ?: NO_ID,
seqNo = policySeqNo ?: SequenceNumbers.UNASSIGNED_SEQ_NO,
primaryTerm = policyPrimaryTerm ?: SequenceNumbers.UNASSIGNED_PRIMARY_TERM
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ fun randomManagedIndexConfig(
policyID = policy?.id ?: policyID,
policySeqNo = policy?.seqNo,
policyPrimaryTerm = policy?.primaryTerm,
policy = policy?.copy(id = ManagedIndexConfig.NO_ID, seqNo = SequenceNumbers.UNASSIGNED_SEQ_NO, primaryTerm = SequenceNumbers.UNASSIGNED_PRIMARY_TERM),
policy = policy?.copy(seqNo = SequenceNumbers.UNASSIGNED_SEQ_NO, primaryTerm = SequenceNumbers.UNASSIGNED_PRIMARY_TERM),
changePolicy = changePolicy
)
}
Expand Down

0 comments on commit 79fb1cb

Please sign in to comment.