nick-boss-tech opened a new pull request, #5003: URL: https://github.com/apache/solr/pull/5003
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-7394 When a leader-eligible replica exhausts its recovery retries, `RecoveryStrategy` now clears the replica's `_recovering` shard-terms entry and resets its term to 0 before publishing `RECOVERY_FAILED`. Previously the entry survived the failed recovery, permanently excluding the replica from leader election. With the entry cleared, the failed replica cannot outrank a still-current replica (its term is reset) but becomes eligible again once the higher-term replica is gone. If the shard-terms cleanup itself throws, the failure is logged and the terminal `RECOVERY_FAILED` publication still goes through. A replica stuck showing RECOVERING with no recovery running is worse than a stale marker on a terminal replica. Includes test-only seams for deterministic coverage: `RecoveryStrategy.testing_maxRetriesOverride` and `TestInjection.failRecovery`. Tests: new `ZkShardTermsRecoveryFailureTest` (cloud-level: exhausts retries via the seams, asserts the `_recovering` entry is gone, the term is 0, and the replica can win election once higher-term replicas are gone), plus `ShardTermsTest` and `TestTestInjection` — 11 tests, 0 failures, green with Error Prone. The new cloud test fails on the unpatched base with `failed replica must not retain a _recovering shard-terms entry`, confirming it reproduces the bug. ### AI assistance AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
