-
Notifications
You must be signed in to change notification settings - Fork 62
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
Handling exception in getAssignment method #881
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,9 +56,14 @@ class ShardReplicationExecutor(executor: String, private val clusterService : Cl | |
} | ||
|
||
override fun getAssignment(params: ShardReplicationParams, clusterState: ClusterState) : Assignment { | ||
val primaryShard = clusterState.routingTable().shardRoutingTable(params.followerShardId).primaryShard() | ||
if (!primaryShard.active()) return SHARD_NOT_ACTIVE | ||
return Assignment(primaryShard.currentNodeId(), "node with primary shard") | ||
try { | ||
val primaryShard = clusterState.routingTable().shardRoutingTable(params.followerShardId).primaryShard() | ||
if (!primaryShard.active()) return SHARD_NOT_ACTIVE | ||
return Assignment(primaryShard.currentNodeId(), "node with primary shard") | ||
} catch (e: Exception) { | ||
log.error("Failed to assign shard replication task with id ${params.followerShardId}", e) | ||
return SHARD_NOT_ACTIVE | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add UTs for the assignment logic and can we validate the changes required for Index Replication task as well? (if any) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Index Replication task does not attach to particular node, so there assignment can happen on any node. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UT has been added |
||
|
||
override fun nodeOperation(task: AllocatedPersistentTask, params: ShardReplicationParams, state: PersistentTaskState?) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For testing, will _stop API clear these entries when the shards are not active?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this we are taking another issue
#903