Restore super_read_only to initial state after SetReplicationSource#801
Draft
tanjinx wants to merge 1 commit intoslack-22.0from
Draft
Restore super_read_only to initial state after SetReplicationSource#801tanjinx wants to merge 1 commit intoslack-22.0from
tanjinx wants to merge 1 commit intoslack-22.0from
Conversation
ae635de to
c46d898
Compare
…demotion After a PRIMARY is demoted, DemotePrimary sets super_read_only=ON for safety during the critical demotion phase. However, normal replicas don't have super_read_only enabled by default. This change adds a vttablet configuration flag --disable_super_read_only (default false) that controls whether to turn off super_read_only in SetReplicationSource after replication is established. When --disable_super_read_only=false (default): super_read_only remains enabled after demotion, providing extra protection. When --disable_super_read_only=true: super_read_only is turned off to match normal replica behavior. The safety benefit of super_read_only=ON during the demotion phase is preserved in both cases. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> Signed-off-by: Tanjin Xu <tanjin.xu@slack-corp.com>
c46d898 to
2b9df49
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## slack-22.0 #801 +/- ##
==============================================
+ Coverage 67.53% 69.78% +2.25%
==============================================
Files 1600 1605 +5
Lines 261782 214036 -47746
==============================================
- Hits 176786 149374 -27412
+ Misses 84996 64662 -20334 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
After a PRIMARY is demoted, DemotePrimary sets super_read_only=ON for safety during the critical demotion phase. However, normal replicas don't have super_read_only enabled by default (unless explicitly configured in my.cnf).
This change captures the initial super_read_only state at tablet startup (reflecting the my.cnf configuration) and restores it after SetReplicationSource completes. This ensures demoted primaries behave consistently with other replicas in the shard.
Files Changed:
- Added disableSuperReadOnly flag variable (default false)
- Registered --disable_super_read_only flag
- Added logic to turn off super_read_only after demotion when flag is enabled
- Only applies when wasPrimary && disableSuperReadOnly
- Added documentation for --disable_super_read_only flag
- Added documentation for --disable_super_read_only flag
Behavior:
Default (--disable_super_read_only=false):
Enabled (--disable_super_read_only=true):
The safety benefit of super_read_only=ON during the critical demotion phase is preserved in
both cases.
Description
Related Issue(s)
Checklist
Deployment Notes
AI Disclosure