MySqlConnector
MySqlConnector copied to clipboard
Verify server ID before `KILL QUERY`
MySqlCommand.Cancel attempts to ensure that KILL QUERY runs on the correct server by connecting directly to its IP address:
https://github.com/mysql-net/MySqlConnector/blob/4cbcfc72063a74c02003a781174f9393660fe731/src/MySqlConnector/MySqlConnection.cs#L913-L921
In a layer 4 load balancing scenario, this might not be sufficient. Running SELECT @@server_uuid; or SELECT @@server_id; at connection establishment time (depending on which servers support those system variables) could provide a unique ID that the Cancel implementation could check before it cancels the query. This would avoid cancelling a query that just happens to use the same server thread ID on a different server.