vitessio / vitess

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

VReplication: recover from closed connection #17249

Closed shlomi-noach closed 1 day ago

shlomi-noach commented 3 days ago

Description

When vreplicator fails, check if its connection is closed, and if so, reopen it. This addresses https://github.com/vitessio/vitess/issues/17248 where the binlog connection auto closes itself in response to a bad commit (MySQL error 1180), but will just as well apply to any situation where the connection closes. It's imperative to open the connection so as to be able to set state/message.

Related Issue(s)

Fixes https://github.com/vitessio/vitess/issues/17248

Checklist

Deployment Notes

vitess-bot[bot] commented 3 days 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 3 days ago

Codecov Report

Attention: Patch coverage is 56.25000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 67.39%. Comparing base (216fd70) to head (4c9eb03). Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...vttablet/tabletmanager/vreplication/vreplicator.go 70.00% 3 Missing :warning:
go/vt/binlog/binlogplayer/dbclient.go 0.00% 2 Missing :warning:
go/vt/binlog/binlogplayer/fake_dbclient.go 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #17249 +/- ## ======================================= Coverage 67.39% 67.39% ======================================= Files 1570 1570 Lines 252917 252930 +13 ======================================= + Hits 170446 170470 +24 + Misses 82471 82460 -11 ```

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


🚨 Try these New Features: