MySQL: Exception restoring original database on a connection to a dropped database #2176
Labels
Milestone
Comments
axelfontaine
added a commit
to flyway/flywaydb.org
that referenced
this issue
Oct 23, 2018
Thank you for isolating this. It was due to stale data inside the JDBC driver. We have now switched to querying the database server directly instead to determine the current database, which fixed the issue. |
Thank you for the quick turnaround on this issue. |
dohrayme
pushed a commit
to dohrayme/flyway
that referenced
this issue
Feb 3, 2020
…connection to a dropped database
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which version and edition of Flyway are you using?
5.2.0
Originally tried with 5.0.7
If this is not the latest version, can you reproduce the issue with the latest one as well?
N/A
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Java API
Which database are you using (type & version)?
MySQL 5.6.37-82.2 Percona Server
Which operating system are you using?
Ubuntu 14.04.5 LTS
What did you do?
I'm using HikariCP (3.2.0, originally used 2.7.9).
A connection is obtained from the data source. The connection is used to set a catalog and later used to drop the database before returning the connection to the pool.
Later, Flyway is given the same data source to perform a migration on a different schema. Flyway obtains the same connection that was returned to the pool above to perform the migration. As a final step Flyway attempts to restore the schema to the original value (ie. one which has been dropped) and an exception occurs indicating: "Unable to restore original schema".
Here is a sample application which can reproduce the issue:
What did you expect to see?
I would not expect Flyway to try to restore the schema, or at least gracefully handle the scenario where the original schema does not exist.
What did you see instead?
The following stack trace was produced:
The text was updated successfully, but these errors were encountered: