Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Transform as an ISM action #760

Merged
merged 38 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9536186
Initial impl
tanqiuliu Apr 5, 2023
679f92b
Merge branch 'opensearch-project:main' into feature/ism_transform
tanqiuliu Apr 12, 2023
7dab6cf
fix style
tanqiuliu Apr 8, 2023
40c9390
end to end functional
tanqiuliu Apr 15, 2023
39cb7b5
ISM transform unit tests & integ tests
tanqiuliu Apr 17, 2023
47721af
Merge branch 'main' into feature/ism_transform
tanqiuliu May 12, 2023
02ed7df
Merge branch 'main' into feature/ism_transform
tanqiuliu Jun 3, 2023
6a75695
Merge branch 'main' into feature/ism_transform
tanqiuliu Jun 18, 2023
10ba7c5
Merge branch 'main' into feature/ism_transform
tanqiuliu Jul 1, 2023
e6699d3
Merge branch 'main' into feature/ism_transform
tanqiuliu Jul 11, 2023
e972c12
Fix after core #8157 (#857)
bowenlan-amzn Jul 19, 2023
157960d
Upgrade the backport workflow (#862)
lezzago Jul 19, 2023
98ddb8d
Added 2.9 release notes. (#851)
AWSHurneyt Jul 21, 2023
271b25b
Handle NPE in isRollupIndex (#855)
blampe Jul 22, 2023
8918a79
Fix core XcontentType refactor (#873)
Hailong-am Jul 27, 2023
60fc6f2
fix for max & min aggregations when no metric property exist (#870)
sbcd90 Jul 28, 2023
c9ba2fb
core refactor change (#884)
Hailong-am Aug 3, 2023
58153bd
update backport branch name (#885)
Hailong-am Aug 7, 2023
513553b
core refactor change (#887)
Hailong-am Aug 8, 2023
4cd7730
Fix breaking change by core refactor (#888)
Hailong-am Aug 10, 2023
d8bb834
fix core breaking (#906)
bowenlan-amzn Aug 25, 2023
3ec3c3e
Support copy alias in rollover (#907)
bowenlan-amzn Sep 1, 2023
716ca89
Set preference to _primary when searching control-center index (#911)
gaobinlong Sep 1, 2023
96ef16e
Add primary first preference to all search requests (#912)
bowenlan-amzn Sep 1, 2023
1ba75b0
fix intelliJ IDEA gradle sync error (#916)
Hailong-am Sep 5, 2023
9a7212d
make control center index as system index (#919)
Hailong-am Sep 6, 2023
a6ea2f7
Updates demo certs used in integ tests (#921)
DarshitChanpura Sep 7, 2023
1b4d9d3
Added 2.10 release notes (#925)
lezzago Sep 8, 2023
e5ff66b
Bump bwc version (#930)
bowenlan-amzn Sep 14, 2023
155f0af
fix integ tests; upgrade mappings versions
tanqiuliu Sep 25, 2023
19003c9
Fix DCO
tanqiuliu Sep 25, 2023
f9b0af4
Merge branch 'main' into feature/ism_transform
tanqiuliu Sep 25, 2023
b0c56b5
Merge branch 'main' into feature/ism_transform
tanqiuliu Oct 5, 2023
0202ea2
Addressed pr comments; Add integ test case for re-execute the same tr…
tanqiuliu Oct 5, 2023
a082860
Addressed detekt error
tanqiuliu Oct 6, 2023
857abe5
Merge branch 'main' into feature/ism_transform
tanqiuliu Oct 6, 2023
2f8c4d6
Added ISMTransform writeable test
tanqiuliu Oct 7, 2023
399afba
Addressed comments; Moved updateTransformStartTime to IndexManagement…
tanqiuliu Oct 10, 2023
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
Prev Previous commit
Next Next commit
end to end functional
Signed-off-by: Tanqiu Liu <liutanqiu@gmail.com>
  • Loading branch information
tanqiuliu committed Apr 15, 2023
commit 40c9390bd107875d719451ccc8112f63db761c24
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ data class TransformActionProperties(
}
}

return TransformActionProperties(requireNotNull(transformId), requireNotNull(hasTransformFailed))
return TransformActionProperties(transformId, hasTransformFailed)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ class IndexManagementPlugin : JobSchedulerExtension, NetworkPlugin, ActionPlugin

val managedIndexCoordinator = ManagedIndexCoordinator(
environment.settings(),
client, clusterService, threadPool, indexManagementIndices, metadataService, templateService, indexMetadataProvider
client, clusterService, threadPool, indexManagementIndices, metadataService, templateService, indexMetadataProvider,
xContentRegistry
)

val smRunner = SMRunner.init(client, threadPool, settings, indexManagementIndices, clusterService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.opensearch.indexmanagement.indexstatemanagement.action.RolloverAction
import org.opensearch.indexmanagement.indexstatemanagement.action.RollupActionParser
import org.opensearch.indexmanagement.indexstatemanagement.action.ShrinkActionParser
import org.opensearch.indexmanagement.indexstatemanagement.action.SnapshotActionParser
import org.opensearch.indexmanagement.indexstatemanagement.action.TransformActionParser
import org.opensearch.indexmanagement.spi.indexstatemanagement.Action
import org.opensearch.indexmanagement.spi.indexstatemanagement.ActionParser
import org.opensearch.indexmanagement.spi.indexstatemanagement.model.ActionRetry
Expand All @@ -49,7 +50,8 @@ class ISMActionsParser private constructor() {
RollupActionParser(),
RolloverActionParser(),
ShrinkActionParser(),
SnapshotActionParser()
SnapshotActionParser(),
TransformActionParser(),
)

val customActionExtensionMap = mutableMapOf<String, String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import org.opensearch.common.regex.Regex
import org.opensearch.common.settings.Settings
import org.opensearch.common.unit.TimeValue
import org.opensearch.commons.authuser.User
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.index.Index
import org.opensearch.index.IndexNotFoundException
import org.opensearch.index.query.QueryBuilders
Expand Down Expand Up @@ -116,7 +117,8 @@ class ManagedIndexCoordinator(
indexManagementIndices: IndexManagementIndices,
private val metadataService: MetadataService,
private val templateService: ISMTemplateService,
private val indexMetadataProvider: IndexMetadataProvider
private val indexMetadataProvider: IndexMetadataProvider,
private val xContentRegistry: NamedXContentRegistry
) : ClusterStateListener,
CoroutineScope by CoroutineScope(SupervisorJob() + Dispatchers.Default + CoroutineName("ManagedIndexCoordinator")),
LifecycleListener() {
Expand Down Expand Up @@ -455,7 +457,7 @@ class ManagedIndexCoordinator(

return try {
val response: SearchResponse = client.suspendUntil { search(searchRequest, it) }
parseFromSearchResponse(response = response, parse = Policy.Companion::parse)
parseFromSearchResponse(response, xContentRegistry, Policy.Companion::parse)
} catch (ex: IndexNotFoundException) {
emptyList()
} catch (ex: ClusterBlockException) {
Expand Down Expand Up @@ -706,7 +708,7 @@ class ManagedIndexCoordinator(
}
mRes.forEach {
if (it.response.isExists) {
result[it.id] = contentParser(it.response.sourceAsBytesRef).parseWithType(
result[it.id] = contentParser(it.response.sourceAsBytesRef, xContentRegistry).parseWithType(
it.response.id, it.response.seqNo, it.response.primaryTerm, ManagedIndexConfig.Companion::parse
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

package org.opensearch.indexmanagement.indexstatemanagement.action

import org.opensearch.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
Expand Down Expand Up @@ -46,4 +49,15 @@ class TransformAction(
}

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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ import kotlin.coroutines.suspendCoroutine

const val OPENDISTRO_SECURITY_PROTECTED_INDICES_CONF_REQUEST = "_opendistro_security_protected_indices_conf_request"

fun contentParser(bytesReference: BytesReference): XContentParser {
fun contentParser(bytesReference: BytesReference, xContentRegistry: NamedXContentRegistry = NamedXContentRegistry.EMPTY): XContentParser {
return XContentHelper.createParser(
NamedXContentRegistry.EMPTY,
xContentRegistry,
LoggingDeprecationHandler.INSTANCE,
bytesReference,
XContentType.JSON
Expand Down
81 changes: 81 additions & 0 deletions src/main/resources/mappings/opendistro-ism-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,83 @@
}
}
},
"transform": {
"properties": {
"ism_transform": {
"properties": {
"description": {
"type": "text"
},
"target_index": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"page_size": {
"type": "long"
},
"data_selection_query": {
"type": "object",
"enabled": false
},
"groups": {
"properties": {
"date_histogram": {
"properties": {
"source_field": {
"type": "keyword"
},
"target_field": {
"type": "keyword"
},
"fixed_interval": {
"type": "keyword"
},
"calendar_interval": {
"type": "keyword"
},
"timezone": {
"type": "keyword"
}
}
},
"terms": {
"properties": {
"source_field": {
"type": "keyword"
},
"target_field": {
"type": "keyword"
}
}
},
"histogram": {
"properties": {
"source_field": {
"type": "keyword"
},
"target_field": {
"type": "keyword"
},
"interval": {
"type": "double"
}
}
}
}
},
"aggregations": {
"type": "object",
"enabled": false
}
}
}
}
},
"shrink": {
"properties": {
"num_new_shards": {
Expand Down Expand Up @@ -783,6 +860,10 @@
"shrink_action_properties": {
"type": "object",
"enabled": false
},
"transform_action_properties": {
"type": "object",
"enabled": false
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/mappings/opendistro-ism-history.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@
"shrink_action_properties": {
"type": "object",
"enabled": false
},
"transform_action_properties": {
"type": "object",
"enabled": false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.opensearch.indexmanagement.indexstatemanagement.ManagedIndexCoordinat
import org.opensearch.indexmanagement.indexstatemanagement.MetadataService
import org.opensearch.indexmanagement.indexstatemanagement.settings.ManagedIndexSettings
import org.opensearch.indexmanagement.indexstatemanagement.migration.ISMTemplateService
import org.opensearch.search.SearchModule
import org.opensearch.test.ClusterServiceUtils
import org.opensearch.test.OpenSearchTestCase
import org.opensearch.threadpool.Scheduler
Expand Down Expand Up @@ -77,7 +78,7 @@ class ManagedIndexCoordinatorTests : OpenSearchAllocationTestCase() {
indexMetadataProvider = IndexMetadataProvider(settings, client, clusterService, mutableMapOf())
coordinator = ManagedIndexCoordinator(
settings, client, clusterService, threadPool, indexManagementIndices, metadataService,
templateService, indexMetadataProvider
templateService, indexMetadataProvider, NamedXContentRegistry(SearchModule(Settings.EMPTY, emptyList()).namedXContents)
)
}

Expand Down