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

MySql check no longer uses Ping #2031

Closed
bgrainger opened this issue Sep 9, 2023 · 4 comments
Closed

MySql check no longer uses Ping #2031

bgrainger opened this issue Sep 9, 2023 · 4 comments
Assignees
Labels
Milestone

Comments

@bgrainger
Copy link
Contributor

What would you like to be added:

Before #1835, MySqlHealthCheck used PingAsync to check the server health. It now defaults to SELECT 1;.

I would like to be able to opt in to using a ping, or even having that restored as the default behavior.

I propose setting the default MySqlHealthCheckOptions.CommandText value to null, and having MySqlHealthCheck interpret that as meaning "ping the server". If CommandText is non-null, then it would be used to form a MySqlCommand.

Why is this needed:

A COM_PING packet will be much more lightweight to send to the server instead of executing a query, even a simple one.

@unaizorrilla
Copy link
Collaborator

A PR is welcome on this!

@unaizorrilla unaizorrilla self-assigned this Sep 19, 2023
bgrainger added a commit to mysql-net/AspNetCore.Diagnostics.HealthChecks that referenced this issue Nov 17, 2023
Users can opt in to setting a command that will be executed on the server, but the default is now a more efficient ping.
bgrainger added a commit to mysql-net/AspNetCore.Diagnostics.HealthChecks that referenced this issue Nov 17, 2023
Users can opt in to setting a command that will be executed on the server, but the default is now a more efficient ping.
@sungam3r sungam3r added mysql Ups for grabs Issue is available to anyone who is interested labels Dec 3, 2023
@sebastienros
Copy link

There is actually another reason to restore the PING command, with this issue

What is happening is that the Docker image for MySql will start in a temporary state then restart in its final state. The health check based on connection string will report healthy during this pre-initialization state. the binary communication however is not enabled until the final restart is done.

In Aspire I am seeing that the functional tests are failing as they are waiting for the health checks to be successful, but then the mysql calls fail because the server restarts.

@bgrainger
Copy link
Contributor Author

I'm not sure that using "ping" will help this scenario. If the health check that sends COM_QUERY with a SELECT 1; payload succeeds, then surely a health check that sends COM_PING would also succeed against the first instance of mysqld that's started in a mysql Docker container?

@bgrainger
Copy link
Contributor Author

bgrainger commented Dec 9, 2023

@sungam3r Why is this issue marked "up for grabs"? I already have a PR that will fix it: #2093 and included in #2096.

@adamsitnik adamsitnik removed the Ups for grabs Issue is available to anyone who is interested label Dec 11, 2023
@adamsitnik adamsitnik assigned bgrainger and unassigned unaizorrilla Dec 11, 2023
@adamsitnik adamsitnik added this to the V 8.0 milestone Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants