vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.67k stars 2.1k forks source link

Fix: Errant GTID detection on the replicas when they set replication source #16833

Closed GuptaManan100 closed 1 month ago

GuptaManan100 commented 1 month ago

Description

This PR adds errant GTID detection logic in setReplicationSourceLocked call. The intent is that we want to prevent any replica that has an errant GTID from even joining the replication stream. This is because we want to prevent this replica from sending semi-sync ACKs, which can land us into some really annoying and hard to deal with situations.

To do the errant GTID detection, the tablets first query their own position and then ask the primary for its position. Then they compare the two to see if they have an errant GTID or not. If they do, they fail the RPC without setting the new source.

Related Issue(s)

Checklist

Deployment Notes

vitess-bot[bot] commented 1 month ago

Review Checklist

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

General

Tests

Documentation

New flags

If a workflow is added or modified:

Backward compatibility

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 43.28358% with 38 lines in your changes missing coverage. Please review.

Project coverage is 69.42%. Comparing base (766bc64) to head (e1e560c). Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vttablet/tabletmanager/rpc_replication.go 0.00% 15 Missing :warning:
go/vt/vttablet/tabletmanager/tm_init.go 48.27% 15 Missing :warning:
go/vt/vttablet/tabletmanager/restore.go 0.00% 8 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #16833 +/- ## ========================================== - Coverage 69.43% 69.42% -0.01% ========================================== Files 1571 1571 Lines 203086 203232 +146 ========================================== + Hits 141013 141101 +88 - Misses 62073 62131 +58 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

GuptaManan100 commented 1 month ago

Thank you for the reviews! I've addressed all review comments and added the release notes changes as requested. I will merge the PR once the tests are green. ♥️