-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.x' into backport1000
- Loading branch information
Showing
29 changed files
with
1,646 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
release-notes/opensearch-index-management.release-notes-2.11.0.0.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Version 2.11.0.0 2023-10-11 | ||
|
||
Compatible with OpenSearch 2.10.0 | ||
|
||
### Maintenance | ||
* Increment version to 2.11.0-SNAPSHOT. ([#922](https://github.com/opensearch-project/index-management/pull/922)) | ||
|
||
### Enhancements | ||
* Provide unique id for each rollup job and add debug logs. ([#968](https://github.com/opensearch-project/index-management/pull/968)) | ||
|
||
### Bug fixes | ||
* Fix auto managed index always have -2 seqNo bug. ([#924](https://github.com/opensearch-project/index-management/pull/924)) | ||
|
||
### Infrastructure | ||
* Upload docker test cluster log. ([#964](https://github.com/opensearch-project/index-management/pull/964)) | ||
* Reduce test running time. ([#965](https://github.com/opensearch-project/index-management/pull/965)) | ||
* Parallel test run. ([#966](https://github.com/opensearch-project/index-management/pull/966)) | ||
* Security test filtered. ([#969](https://github.com/opensearch-project/index-management/pull/969)) | ||
|
||
### Documentation | ||
* Added 2.11 release notes. ([#1004](https://github.com/opensearch-project/index-management/pull/1004)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...rg.opensearch.indexmanagement.spi/indexstatemanagement/model/TransformActionProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.indexmanagement.spi.indexstatemanagement.model | ||
|
||
import org.opensearch.core.common.io.stream.StreamInput | ||
import org.opensearch.core.common.io.stream.StreamOutput | ||
import org.opensearch.core.common.io.stream.Writeable | ||
import org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken | ||
import org.opensearch.core.xcontent.ToXContent | ||
import org.opensearch.core.xcontent.ToXContentFragment | ||
import org.opensearch.core.xcontent.XContentBuilder | ||
import org.opensearch.core.xcontent.XContentParser | ||
|
||
data class TransformActionProperties( | ||
val transformId: String? | ||
) : Writeable, ToXContentFragment { | ||
|
||
override fun writeTo(out: StreamOutput) { | ||
out.writeOptionalString(transformId) | ||
} | ||
|
||
override fun toXContent(builder: XContentBuilder, params: ToXContent.Params?): XContentBuilder { | ||
if (transformId != null) builder.field(Properties.TRANSFORM_ID.key, transformId) | ||
return builder | ||
} | ||
|
||
companion object { | ||
const val TRANSFORM_ACTION_PROPERTIES = "transform_action_properties" | ||
|
||
fun fromStreamInput(sin: StreamInput): TransformActionProperties { | ||
val transformId: String? = sin.readOptionalString() | ||
return TransformActionProperties(transformId) | ||
} | ||
|
||
fun parse(xcp: XContentParser): TransformActionProperties { | ||
var transformId: String? = null | ||
|
||
ensureExpectedToken(XContentParser.Token.START_OBJECT, xcp.currentToken(), xcp) | ||
while (xcp.nextToken() != XContentParser.Token.END_OBJECT) { | ||
val fieldName = xcp.currentName() | ||
xcp.nextToken() | ||
|
||
when (fieldName) { | ||
Properties.TRANSFORM_ID.key -> transformId = xcp.text() | ||
} | ||
} | ||
|
||
return TransformActionProperties(transformId) | ||
} | ||
} | ||
|
||
enum class Properties(val key: String) { | ||
TRANSFORM_ID("transform_id") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...main/kotlin/org/opensearch/indexmanagement/indexstatemanagement/action/TransformAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.indexmanagement.indexstatemanagement.action | ||
|
||
import org.opensearch.core.common.io.stream.StreamOutput | ||
import org.opensearch.core.xcontent.ToXContent | ||
import org.opensearch.core.xcontent.XContentBuilder | ||
import org.opensearch.indexmanagement.indexstatemanagement.step.transform.AttemptCreateTransformJobStep | ||
import org.opensearch.indexmanagement.indexstatemanagement.step.transform.WaitForTransformCompletionStep | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.Action | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.Step | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.model.StepContext | ||
import org.opensearch.indexmanagement.transform.model.ISMTransform | ||
|
||
class TransformAction( | ||
val ismTransform: ISMTransform, | ||
index: Int | ||
) : Action(name, index) { | ||
|
||
companion object { | ||
const val name = "transform" | ||
const val ISM_TRANSFORM_FIELD = "ism_transform" | ||
} | ||
|
||
private val attemptCreateTransformJobStep = AttemptCreateTransformJobStep(this) | ||
private val waitForTransformCompletionStep = WaitForTransformCompletionStep() | ||
private val steps = listOf(attemptCreateTransformJobStep, waitForTransformCompletionStep) | ||
|
||
@Suppress("ReturnCount") | ||
override fun getStepToExecute(context: StepContext): Step { | ||
// if stepMetaData is null, return first step | ||
val stepMetaData = context.metadata.stepMetaData ?: return attemptCreateTransformJobStep | ||
|
||
// if the current step has completed, return the next step | ||
if (stepMetaData.stepStatus == Step.StepStatus.COMPLETED) { | ||
return when (stepMetaData.name) { | ||
AttemptCreateTransformJobStep.name -> waitForTransformCompletionStep | ||
else -> attemptCreateTransformJobStep | ||
} | ||
} | ||
|
||
return when (stepMetaData.name) { | ||
AttemptCreateTransformJobStep.name -> attemptCreateTransformJobStep | ||
else -> waitForTransformCompletionStep | ||
} | ||
} | ||
|
||
override fun getSteps(): List<Step> = steps | ||
|
||
override fun populateAction(builder: XContentBuilder, params: ToXContent.Params) { | ||
builder.startObject(type) | ||
builder.field(ISM_TRANSFORM_FIELD, ismTransform) | ||
builder.endObject() | ||
} | ||
|
||
override fun populateAction(out: StreamOutput) { | ||
ismTransform.writeTo(out) | ||
out.writeInt(actionIndex) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...otlin/org/opensearch/indexmanagement/indexstatemanagement/action/TransformActionParser.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.indexmanagement.indexstatemanagement.action | ||
|
||
import org.opensearch.core.common.io.stream.StreamInput | ||
import org.opensearch.core.xcontent.XContentParser | ||
import org.opensearch.core.xcontent.XContentParserUtils | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.Action | ||
import org.opensearch.indexmanagement.spi.indexstatemanagement.ActionParser | ||
import org.opensearch.indexmanagement.transform.model.ISMTransform | ||
|
||
class TransformActionParser : ActionParser() { | ||
override fun fromStreamInput(sin: StreamInput): Action { | ||
val ismTransform = ISMTransform(sin) | ||
val index = sin.readInt() | ||
return TransformAction(ismTransform, index) | ||
} | ||
|
||
override fun fromXContent(xcp: XContentParser, index: Int): Action { | ||
var ismTransform: ISMTransform? = null | ||
|
||
XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, xcp.currentToken(), xcp) | ||
while (xcp.nextToken() != XContentParser.Token.END_OBJECT) { | ||
val fieldName = xcp.currentName() | ||
xcp.nextToken() | ||
|
||
when (fieldName) { | ||
TransformAction.ISM_TRANSFORM_FIELD -> ismTransform = ISMTransform.parse(xcp) | ||
else -> throw IllegalArgumentException("Invalid field: [$fieldName] found in TransformAction.") | ||
} | ||
} | ||
|
||
return TransformAction(ismTransform = requireNotNull(ismTransform) { "TransformAction transform is null." }, index) | ||
} | ||
|
||
override fun getActionType(): String { | ||
return TransformAction.name | ||
} | ||
} |
Oops, something went wrong.