vitessio / vitess

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

vstreamer leaking binlog streams? #6939

Closed aquarapid closed 6 months ago

aquarapid commented 3 years ago

On current master (d6c9ddf71cefdaa13d0e57fb1353e347523dd713).

Scenario:

aquarapid commented 3 years ago

It was pointed out that these binlog steams will die off as soon as the server tries to send an event down them (e.g. there is an update/insert/delete to the upstream MySQL instance). So if the underlying MySQL instance is receiving regular updates, you might not notice this at all.

aquarapid commented 3 years ago

After some experimentation, I found that AWS Aurora still "leaks" binlog streams even if you reuse the server_id. So, unless the upstream instance is actively receiving writes, you could eventually exhaust all the db connections. It looks like the only approach that is guaranteed to work is that followed by the binlog streamer in go-mysql, which is to open a separate connection and kill the binlog dump session using KILL xxx

enisoc commented 3 years ago

It looks like the only approach that is guaranteed to work is that followed by the binlog streamer in go-mysql, which is to open a separate connection and kill the binlog dump session using KILL xxx

How does a real mysql replica tell the server that it's going away? Or does it not, and this orphan problem exists for real replicas too when no transactions are flowing?

aquarapid commented 3 years ago

It re-uses the server_id. Things in AWS Aurora seem to work differently; because I suspect under the covers they're using a completely different binlog "server" implementation.

mattlord commented 6 months ago

I'm going to close this for now as SO much in this area has changed in the last 3.5 years and I don't see a test case here to know if it's still an issue.

If you believe that this is still an issue then please provide additional details and we can reopen the issue at any time. Thanks!