Skip to content

EmergencyReparentShard: include SQL thread position in most-advanced candidate selection #18531

Merged
timvaillancourt merged 6 commits intovitessio:mainfrom
timvaillancourt:reparentutil-sorter-sqlExec
Sep 30, 2025
Merged

EmergencyReparentShard: include SQL thread position in most-advanced candidate selection #18531
timvaillancourt merged 6 commits intovitessio:mainfrom
timvaillancourt:reparentutil-sorter-sqlExec

Conversation

@timvaillancourt
Copy link
Contributor

@timvaillancourt timvaillancourt commented Aug 1, 2025

Description

This PR gives the tablet sorter in the EmergencyReparentShard context of how advanced the SQL thread of replicas are. This is used to sort the best candidate when two tablets have the same relay log GTID set

As of this PR, this additional sort dimension won't have any benefit - because the ERS code currently waits for EVERY tablet to apply relay logs, but future PRs I have planned can build on this behaviour, for example the implementation of this RFC: #18529

Related Issue(s)

#18529

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

@vitess-bot
Copy link
Contributor

vitess-bot bot commented Aug 1, 2025

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Aug 1, 2025
@github-actions github-actions bot added this to the v23.0.0 milestone Aug 1, 2025
@timvaillancourt timvaillancourt changed the title EmergencyReparentShard: include SQL thread position in candidate selection EmergencyReparentShard: include SQL thread position in most-advanced candidate selection Aug 1, 2025
@timvaillancourt timvaillancourt added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: vtctl and removed NeedsWebsiteDocsUpdate What it says NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Aug 1, 2025
@codecov
Copy link

codecov bot commented Aug 1, 2025

Codecov Report

❌ Patch coverage is 86.88525% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.52%. Comparing base (6b4fa3d) to head (614da3f).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vtctl/reparentutil/replication.go 82.60% 4 Missing ⚠️
go/vt/vtctl/reparentutil/util.go 83.33% 3 Missing ⚠️
go/vt/vtctl/reparentutil/emergency_reparenter.go 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18531      +/-   ##
==========================================
+ Coverage   67.50%   67.52%   +0.02%     
==========================================
  Files        1608     1608              
  Lines      263594   263624      +30     
==========================================
+ Hits       177931   178004      +73     
+ Misses      85663    85620      -43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timvaillancourt timvaillancourt removed the NeedsIssue A linked issue is missing for this Pull Request label Aug 1, 2025
@timvaillancourt timvaillancourt marked this pull request as ready for review August 1, 2025 21:32
@timvaillancourt timvaillancourt removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Aug 1, 2025
@timvaillancourt timvaillancourt force-pushed the reparentutil-sorter-sqlExec branch from b170d7e to f730c19 Compare August 1, 2025 22:43
@timvaillancourt
Copy link
Contributor Author

timvaillancourt commented Aug 19, 2025

This PR is ready for another round of reviews now 👍

We've done some internal testing and find this works as planned: which is allow ERS to skip the wait-for-applying-relaylogs phase on a minority of least-advanced tablets

The idea is we know in advance they will never be the most-advanced post-relaylog-apply, so there's no need to wait on them

…d candidate selection

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
@timvaillancourt timvaillancourt enabled auto-merge (squash) September 26, 2025 21:40
@timvaillancourt timvaillancourt merged commit e87882e into vitessio:main Sep 30, 2025
103 of 108 checks passed
@timvaillancourt timvaillancourt deleted the reparentutil-sorter-sqlExec branch September 30, 2025 13:59
tanjinx pushed a commit to slackhq/vitess that referenced this pull request Nov 4, 2025
…d candidate selection (vitessio#18531)

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
tanjinx added a commit to slackhq/vitess that referenced this pull request Nov 5, 2025
…d candidate selection (vitessio#18531) (#736)

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: Tim Vaillancourt <tim@timvaillancourt.com>
tanjinx added a commit to slackhq/vitess that referenced this pull request Nov 10, 2025
…d candidate selection (vitessio#18531) (#736)

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: Tim Vaillancourt <tim@timvaillancourt.com>
sbaker617 pushed a commit to slackhq/vitess that referenced this pull request Feb 5, 2026
…d candidate selection (vitessio#18531) (#736)

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Co-authored-by: Tim Vaillancourt <tim@timvaillancourt.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: vtctl Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants