-
Notifications
You must be signed in to change notification settings - Fork 61
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
Conversation
Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #881 +/- ##
=============================================
- Coverage 72.39% 46.18% -26.22%
+ Complexity 1007 630 -377
=============================================
Files 141 141
Lines 4695 4699 +4
Branches 527 527
=============================================
- Hits 3399 2170 -1229
- Misses 963 2270 +1307
+ Partials 333 259 -74
|
Security and knn tests are failing due to known build failures with security plugin
|
@nisgoel-amazon will this be backported to all other branches ? |
yes |
} 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 comment
The 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 comment
The 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.
Those tasks are working fine
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.
UT has been added
if (!primaryShard.active()) return SHARD_NOT_ACTIVE | ||
return Assignment(primaryShard.currentNodeId(), "node with primary shard") | ||
try { | ||
val primaryShard = clusterState.routingTable().shardRoutingTable(params.followerShardId).primaryShard() |
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
Signed-off-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268)
* Handling exception in getAssignment method Handling exception in getAssignment method * Adding UT for getAssignment Method --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) Co-authored-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) Co-authored-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) Co-authored-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901)
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901)
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901)
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901)
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901)
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901) Co-authored-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901) Co-authored-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901) Co-authored-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method (#937) * Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]>
* Handling exception in getAssignment method (#937) * Handling exception in getAssignment method (#881) * Handling exception in getAssignment method Handling exception in getAssignment method Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> * Adding UT for getAssignment Method Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 14b9268) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]> (cherry picked from commit 2c28901) * Fixing build Signed-off-by: Nishant Goel <[email protected]> --------- Signed-off-by: Nishant Goel <[email protected]>
Handling exception in getAssignment method
Description
getAssignment method is used to assign shard replication task via persistent task cluster service. In case of stale entries present in persistent tasks in cluster state when this method is trying to assign task it is not handled properly.
Most of the times stale entries are not present in cluster state as we are clearing them at the time of cancelling the replication task but if cancelling is failed by any reason then these entries can remain in the cluster state.
Issues Resolved
#880
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.