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 meta got "bad connection" error, should retry it #5441

Open
anysql opened this issue Dec 26, 2024 · 0 comments
Open

MySQL meta got "bad connection" error, should retry it #5441

anysql opened this issue Dec 26, 2024 · 0 comments
Labels
kind/feature New feature or request

Comments

@anysql
Copy link

anysql commented Dec 26, 2024

What would you like to be added:

2024/12/26 15:07:12.242607 juicefs[2716000] : error: bad connection

Check the shouldRetry function, if the database is postgresql it will retry, but not for mysql

    case "mysql":
            // MySQL, MariaDB or TiDB
            return strings.Contains(msg, "try restarting transaction") || strings.Contains(msg, "try again later") ||
                    strings.Contains(msg, "duplicate entry")
    case "postgres":
            return strings.Contains(msg, "current transaction is aborted") || strings.Contains(msg, "deadlock detected") ||
                    strings.Contains(msg, "duplicate key value") || strings.Contains(msg, "could not serialize access") ||
                    strings.Contains(msg, "bad connection") || errors.Is(err, io.EOF) // could not send data to client: No buffer space available

Why is this needed:

The bad connection error is reported by database/sql, when a connection lost abnormally, it's not a database specific error.
So mysql database should retry this error too.

@anysql anysql added the kind/feature New feature or request label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant