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

Fix the flaky in allocation IT during multinode test #983

Merged
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 @@ -26,7 +26,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
val states = listOf(
State("Allocate", listOf(actionConfig), listOf())
)

val policy = Policy(
id = policyID,
description = "$testIndexName description",
Expand Down Expand Up @@ -66,12 +65,10 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
createIndex(indexName, null, null, "0")

availableNodes.remove(getIndexShardNodes(indexName)[0])

val actionConfig = AllocationAction(require = mapOf("_name" to availableNodes.first()), exclude = emptyMap(), include = emptyMap(), index = 0)
val states = listOf(
State("Allocate", listOf(actionConfig), listOf())
)

val policy = Policy(
id = policyID,
description = "$testIndexName description",
Expand Down Expand Up @@ -100,9 +97,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
assertEquals(actionConfig.require["_name"], settings["index.routing.allocation.require._name"])
}

// Third execution: Waits for allocation to complete, which will happen in this execution since index is small
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to trigger the third execution, since the second execution already apply the allocation setting, and we just need to wait for the setting takes effect

The third execution trigger seems collide with the deletion of ISM system index in multi-node test, which could like to a corrupt node lock. Check the analysis here #90 (comment)

updateManagedIndexConfigStartTime(managedIndexConfig)

waitFor {
assertEquals(availableNodes.first(), getIndexShardNodes(indexName)[0])
}
Expand All @@ -117,12 +111,10 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
createIndex(indexName, null, null, "0")

val excludedNode = getIndexShardNodes(indexName)[0].toString()

val actionConfig = AllocationAction(require = emptyMap(), exclude = mapOf("_name" to excludedNode), include = emptyMap(), index = 0)
val states = listOf(
State("Allocate", listOf(actionConfig), listOf())
)

val policy = Policy(
id = policyID,
description = "$testIndexName description",
Expand Down Expand Up @@ -151,9 +143,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
assertEquals(actionConfig.exclude["_name"], settings["index.routing.allocation.exclude._name"])
}

// Third execution: Waits for allocation to complete, which will happen in this execution since index is small
updateManagedIndexConfigStartTime(managedIndexConfig)

waitFor {
assertNotEquals(excludedNode, getIndexShardNodes(indexName)[0])
}
Expand All @@ -169,7 +158,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
createIndex(indexName, null, null, "0")

availableNodes.remove(getIndexShardNodes(indexName)[0])

val actionConfig = AllocationAction(require = emptyMap(), exclude = emptyMap(), include = mapOf("_name" to availableNodes.first()), index = 0)
val states = listOf(
State("Allocate", listOf(actionConfig), listOf())
Expand Down Expand Up @@ -203,9 +191,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
assertEquals(actionConfig.include["_name"], settings["index.routing.allocation.include._name"])
}

// Third execution: Waits for allocation to complete, which will happen in this execution since index is small
updateManagedIndexConfigStartTime(managedIndexConfig)

waitFor {
assertEquals(availableNodes.first(), getIndexShardNodes(indexName)[0])
}
Expand All @@ -218,7 +203,6 @@ class AllocationActionIT : IndexStateManagementRestTestCase() {
val states = listOf(
State("Allocate", listOf(actionConfig), listOf())
)

val policy = Policy(
id = policyID,
description = "$testIndexName description",
Expand Down
Loading