-
Notifications
You must be signed in to change notification settings - Fork 277
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
Add --wait-interval
and $DBMATE_WAIT_INTERVAL
to make wait interval configurable at runtime
#516
Comments
So, the error is being logged by the go-sql-driver/mysql driver, not by I suspect the issue is caused by how k8s implements cluster networking, specifically in the case where there's a Service that registers the port for the service but has no Pods available to forward that traffic to, yet. In this case, K8s is accepting the connection on its ingress, but then drops the connection as there's no Pod to forward it to, which the MySQL client treats as an unexpected EOF (end of file, or in this case, server-closed network connection) and the driver is implemented to log that occurrence. We have no direct control over the MySQL driver's behavior itself, so the best we could do from the I think adding @jessebye, what do you think? |
@dossy seems like a reasonable approach, given the context 👍 |
--wait-interval
and $DBMATE_WAIT_INTERVAL
to make wait interval configurable at runtime
I would like to contribute code to this issue if we decide that it should be implemented @dossy . |
I think that as long as the implementation preserves the current behavior by default, I think a contribution implementing this configurability would be useful to those who need it. While there don't appear to be too many people who have come forward look for or needing this functionality, it is certainly a quality-of-life improvement that some folks may appreciate. |
I think we should silence any errors from mysql driver while we are in the "wait" operation. If there are any real error messages people need to uncover for debugging, they can run any other dbmate command. Adding |
How do you feel about emitting the errors if and when |
Do we need it? The In this case, the mysql driver is taking matters into its own hands and spewing some console output about an error in addition to returning an error. I think that is bad behavior of the driver and we should suppress it (along with the error which we already suppress). |
Description
When using the
--wait
flag anddbmate up
is run before the DB is ready, the logs are flooded with this message:Eventually it stops when the DB is ready and it can run migrations:
Steps To Reproduce
Set up a K8S job that will run the dbmate container against a K8S mysql pod. Restart the mysql pod then kick off the dbmate job with
--wait
flag. Observe the log messages.Expected Behavior
I would expect to see the message
Waiting for database
and a.
for each time it attempts connection until it succeeds.The text was updated successfully, but these errors were encountered: