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 connection times out after pt-online-schema-change run #106

Closed
hseffler opened this issue May 17, 2021 · 2 comments · Fixed by #117
Closed

MySQL connection times out after pt-online-schema-change run #106

hseffler opened this issue May 17, 2021 · 2 comments · Fixed by #117
Assignees
Milestone

Comments

@hseffler
Copy link

When using pt-online-schema-change from liquibase via liquibase-percona the following happens for long migrations:

  1. liquibase locks the database
  2. pt-online-schema-change runs and executes sucessfully
  3. liquibase tries to write the changelog entry and remove the lock

However the jdbc database connection that liquibase is using has gone idle in the meantime and the liquibase run fails and requires manual intervention.

db: mysql
liquibase: 3.5.1
liquibase-percona: 1.6.0

@adangel
Copy link
Collaborator

adangel commented May 24, 2021

Do you use some specific connection properties? How long took pt-online-schema-change to run?

You are maybe running into the timeout, that the configurable server-side as wait_timeout. This is by default 8 hours.
You could try to play with autoReconnect. But according to the description, the driver will still throw a exception, so liquibase's query to write the changelog entry probably still doesn't work.

We probably need a small background thread to keep liquibase's connection alive while pt-online-schema-change uses its own connection.

@adangel adangel changed the title MySQL Connections times out after pt-online-schema-change run MySQL connection times out after pt-online-schema-change run May 24, 2021
@hseffler
Copy link
Author

In my scenario pt-online-schema-change runs for more than 1h, its quite a large production database. I already tried the autoReconnect-flag of the mysql-driver, but as you noted it still throws an exception before eventually reconnecting, so this does not help in this case.

wait_timeout on the mysql-server-side would possibly help but its set to a much lower value due to other constraints on this database by the mysql-admins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants