Repository navigation
Fail the shard copy in the local cluster state in LocalShardStateAction - #23220
Conversation
In clusterless mode, localShardFailed was a no-op. IndicesClusterStateService puts a failed shard in its failedShardsCache and does not create it again until the shard's routing entry names a different allocation. With the entry left as it was, whatever builds the local cluster state kept reusing it, so the copy never came back and the state kept reporting it as started. localShardFailed now does locally what AllocationService#applyFailedShards does on a cluster manager: it moves the copy to unassigned with ALLOCATION_FAILED, the message and failure, and an incremented failed-allocation count. The copy is looked up by allocation id in the state being updated, not by equality with the routing that failed, since that routing may be out of date (for example, marked started since). A failure for an allocation that is no longer in the state changes nothing. Primary terms and in-sync allocation ids are left alone, and so is re-allocation; those belong to whatever builds the local cluster state. The listener is completed once the update is applied, or with the failure. Signed-off-by: Michael Froh <m_froh@apple.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
❌ Gradle check result for 1ac5449: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23220 +/- ##
============================================
+ Coverage 71.77% 71.83% +0.06%
- Complexity 77953 78061 +108
============================================
Files 6185 6185
Lines 361363 361432 +69
Branches 52596 52618 +22
============================================
+ Hits 259370 259643 +273
+ Misses 81440 81148 -292
- Partials 20553 20641 +88 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
597ed9e
into
opensearch-project:main
Description
In clusterless mode, localShardFailed was a no-op. IndicesClusterStateService puts a failed shard in its failedShardsCache and does not create it again until the shard's routing entry names a different allocation. With the entry left as it was, whatever builds the local cluster state kept reusing it, so the copy never came back and the state kept reporting it as started.
localShardFailed now does locally what AllocationService#applyFailedShards does on a cluster manager: it moves the copy to unassigned with ALLOCATION_FAILED, the message and failure, and an incremented failed-allocation count. The copy is looked up by allocation id in the state being updated, not by equality with the routing that failed, since that routing may be out of date (for example, marked started since). A failure for an allocation that is no longer in the state changes nothing. Primary terms and in-sync allocation ids are left alone, and so is re-allocation; those belong to whatever builds the local cluster state. The listener is completed once the update is applied, or with the failure.
Related Issues
N/A
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.