Coder Social home page Coder Social logo

Comments (7)

Mizaro avatar Mizaro commented on August 15, 2024 1

I would like to contribute code to this issue if we decide that it should be implemented @dossy .

from dbmate.

amacneil avatar amacneil commented on August 15, 2024 1

How do you feel about emitting the errors if and when --verbose is also specified?

Do we need it?

The wait command expects an error. Encountering an error is a normal part of its operation - that is the whole point of the command, to attempt a connection, and if there is an error to catch it and retry. For all other database drivers today we handle and suppress the error details.

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).

from dbmate.

dossy avatar dossy commented on August 15, 2024

So, the error is being logged by the go-sql-driver/mysql driver, not by dbmate itself.

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 dbmate end would be to expose the DB.WaitInterval as a command-line argument, as it's currently defaulted to 1 second which could be quite noisy if it takes a few minutes for the Pod to become available.

I think adding --wait-interval and $DBMATE_WAIT_INTERVAL as ways of setting the interval could be a useful addition, but ultimately I suspect just ignoring the noisy logging from the go-sql-driver/mysql driver is the path of least resistance ... 😄

@jessebye, what do you think?

from dbmate.

jessebye avatar jessebye commented on August 15, 2024

@dossy seems like a reasonable approach, given the context 👍

from dbmate.

dossy avatar dossy commented on August 15, 2024

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.

from dbmate.

amacneil avatar amacneil commented on August 15, 2024

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 --wait-interval cli flag seems reasonable (it is already exposed to API users), but it's not going to prevent this spam going to the console. So let's fix that first.

from dbmate.

dossy avatar dossy commented on August 15, 2024

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 --wait-interval cli flag seems reasonable (it is already exposed to API users), but it's not going to prevent this spam going to the console. So let's fix that first.

How do you feel about emitting the errors if and when --verbose is also specified?

from dbmate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.