Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass Port and UserId to cancel connection #1305

Merged

Conversation

stilettk
Copy link
Contributor

@stilettk stilettk commented Apr 8, 2023

Fixes #1302.

When canceling a connection, current Port and UserID are passed to new connection, because host, port and user might be different when the server supports redirection (and using ServerRedirectionMode).

Signed-off-by: Nickolay Batov <stilettk@gmail.com>
@stilettk
Copy link
Contributor Author

stilettk commented Apr 8, 2023

@bgrainger unfortunately, I couldn’t figure it out how to write an integration test for it. I didn't find a way to setup a database with server redirection.

Can you help me with that?

@bgrainger
Copy link
Member

The only server I know that supports it is Azure Database for MySQL Single Server. I don't have an instance of that available for integration tests, and am unlikely to set that up because it will be retired by September 2024: https://learn.microsoft.com/en-us/azure/mysql/single-server/whats-happening-to-mysql-single-server. (Based on #1302 I assume you're using Azure Single Server so please be aware that you've got less than eighteen months to migrate off it.)

If there was an OSS MySQL DB that supported redirection, we could try integration testing in a Docker container. However, I'm not aware of one. (MariaDB was considering it as a potential feature, but it was never implemented AFAIK.)

@stilettk
Copy link
Contributor Author

stilettk commented Apr 8, 2023

What are the options then? Merge this PR without an integration test for the bug?

Based on #1302 I assume you're using Azure Single Server so please be aware that you've got less than eighteen months to migrate off it.

Yes, thank you, migration is planned, but it's still a plenty of time to live with it so this fix is useful for us.

@bgrainger
Copy link
Member

What are the options then? Merge this PR without an integration test for the bug?

I can use the AZ CLI to create a new Single Server instance and do ad-hoc testing, as well as code review.

bgrainger added a commit that referenced this pull request Apr 8, 2023
…irect

Pass Port and UserId to cancel connection. Fixes #1302
@bgrainger bgrainger merged commit ca2cf51 into mysql-net:master Apr 8, 2023
21 checks passed
@bgrainger
Copy link
Member

I performed some small code cleanup, and tested with a private Azure Database for MySQL Single Server instance. Your PR fixed the failure to connect when cancelling a query.

Thanks for the fix!

@stilettk stilettk deleted the fix-cancel-connection-when-redirect branch April 13, 2023 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

UnableToConnectToHost when canceling redirected connection
2 participants