vtorc: add topo-based recovery cooldown for ERS/PRS - #819
Closed
sbaker617 wants to merge 2 commits into
Closed
Conversation
…eparents Multiple VTOrc instances monitoring the same cluster can independently detect a problem and race to perform ERS/PRS. While the topo shard lock prevents truly concurrent operations, there's no protection against rapid sequential reparents. This adds a configurable cooldown window (--recovery-cooldown-duration) that prevents VTOrc from performing another cluster-wide recovery on the same shard within X seconds. The cooldown marker is stored in topo server metadata, making it visible across all VTOrc instances. Only cluster-wide recoveries (ERS/PRS) are gated; non-cluster-wide fixes and manual vtctld/reparenting-solver operations are unaffected. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Steve Baker <s.baker@slack-corp.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## slack-22.0 #819 +/- ##
==============================================
- Coverage 69.80% 69.80% -0.01%
==============================================
Files 1606 1607 +1
Lines 214099 214166 +67
==============================================
+ Hits 149454 149490 +36
- Misses 64645 64676 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Move all cooldown types, functions, metric, and tests into dedicated files (topology_recovery_cooldown.go and topology_recovery_cooldown_test.go) so that upstream backports only conflict on the two small call sites in topology_recovery.go (~19 lines) rather than the full implementation. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Steve Baker <s.baker@slack-corp.com>
|
This PR is being marked as stale because it has been open for 30 days with no activity. To rectify, you may do any of the following:
If no action is taken within 7 days, this PR will be closed. |
|
This PR was closed because it has been stale for 7 days with no activity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's this?
Adds a configurable cooldown window (
--recovery-cooldown-duration) that prevents VTOrc from performing another cluster-wide recovery (ERS/PRS) on the same shard within a configurable time period. This addresses flapping scenarios where multiple VTOrc instances rapidly execute sequential reparents.How it works
metadata/recovery_cooldown/{keyspace}/{shard}LockShard()to avoid unnecessary lock contention across instances0(disabled) for backwards compatibilityWhat's NOT affected
vtctldclientERS/PRS operations — they go throughgrpcvtctldserver, never touch VTOrc's recovery pathreparenting-solver— uses vtctldclient gRPC, same unaffected pathisClusterWideRecovery()New config
--recovery-cooldown-duration0(disabled)New metric
RecoveriesCooldownSkipped(labels: RecoveryType, Keyspace, Shard) — counts skipped recoveries due to active cooldownDesign note: file structure for fork maintainability
The first commit inlines everything into
topology_recovery.go. The second commit restructures to minimize the diff against upstream files — all cooldown logic and tests live in new standalone files (topology_recovery_cooldown.go,topology_recovery_cooldown_test.go) that we fully own. The only edits to upstream files are:topology_recovery.go: ~19 lines (two call sites that invoke the cooldown check/write)config.go: ~20 lines (flag definition, registration, getter)metadata.go: ~13 lines (GetSingleMetadatawrapper)This way upstream backports only risk conflicts at the small call-site insertions, not the full implementation. Reviewer can compare the two commits to see both approaches.
Most of this was written by Claude Code — I just provided direction.