flyway - Issue on Google App Engine GAE: Unable to lock table schema_version -
we on gae cloud sql. works great on local dev server. using appenginedriver static connection string. connection in production environment flyway able create schema_version table.
but error it's not able lock said table. table empty. have 3 migrations , none have been executed.
we launch migration @ time spring creates datasource bean, in java config style.
here's stack trace.
many thanks!
update 1: have added relevant secondary stack trace @ end of first one.
com.googlecode.flyway.core.api.flywayexception: unable lock table ourschema
.schema_version
: java.sql.sqlexception: command not supported in prepared statement protocol yet @ com.google.cloud.sql.jdbc.internal.exceptions.newsqlexception(exceptions.java:219) @ com.google.cloud.sql.jdbc.internal.sqlprotoclient.check(sqlprotoclient.java:198) @ com.google.cloud.sql.jdbc.internal.sqlprotoclient.executesql(sqlprotoclient.java:87) @ com.google.cloud.sql.jdbc.internal.sqlprotoclient.executesql(sqlprotoclient.java:76) @ com.google.cloud.sql.jdbc.connection.executesql(connection.java:528) @ com.google.cloud.sql.jdbc.preparedstatement.executesqlimpl(preparedstatement.java:141) @ com.google.cloud.sql.jdbc.statement.executeimpl(statement.java:154) @ com.google.cloud.sql.jdbc.preparedstatement.execute(preparedstatement.java:122) @ com.googlecode.flyway.core.dbsupport.jdbctemplate.execute(jdbctemplate.java:214) @ com.googlecode.flyway.core.dbsupport.mysql.mysqltable.dolock(mysqltable.java:58) @ com.googlecode.flyway.core.dbsupport.table.lock(table.java:254) @ com.googlecode.flyway.core.metadatatable.metadatatableimpl.lock(metadatatableimpl.java:121) @ com.googlecode.flyway.core.command.dbmigrate$1.dointransaction(dbmigrate.java:140) @ com.googlecode.flyway.core.command.dbmigrate$1.dointransaction(dbmigrate.java:138) @ com.googlecode.flyway.core.util.jdbc.transactiontemplate.execute(transactiontemplate.java:54) @ com.googlecode.flyway.core.command.dbmigrate.migrate(dbmigrate.java:137) @ com.googlecode.flyway.core.flyway$1.execute(flyway.java:862) @ com.googlecode.flyway.core.flyway$1.execute(flyway.java:815) @ com.googlecode.flyway.core.flyway.execute(flyway.java:1177) @ com.googlecode.flyway.core.flyway.migrate(flyway.java:815) @ com.ourapplication.pilote.persistence.flywaymigrationdatasourceinitializer.postinitialize(flywaymigrationdatasourceinitializer.java:23) @ com.ourapplication.pilote.persistence.persistenceconfiguration.initializedatasource(persistenceconfiguration.java:188) @ com.ourapplication.pilote.persistence.persistenceconfiguration.datasource(persistenceconfiguration.java:175)
caused by: java.sql.sqlexception: command not supported in prepared statement protocol yet @ com.google.cloud.sql.jdbc.internal.exceptions.newsqlexception(exceptions.java:219) @ com.google.cloud.sql.jdbc.internal.sqlprotoclient.check(sqlprotoclient.java:198) @ com.google.cloud.sql.jdbc.internal.sqlprotoclient.executesql(sqlprotoclient.java:87) @ com.google.cloud.sql.jdbc.internal.sqlprotoclient.executesql(sqlprotoclient.java:76) @ com.google.cloud.sql.jdbc.connection.executesql(connection.java:528) @ com.google.cloud.sql.jdbc.preparedstatement.executesqlimpl(preparedstatement.java:141) @ com.google.cloud.sql.jdbc.statement.executeimpl(statement.java:154) @ com.google.cloud.sql.jdbc.preparedstatement.execute(preparedstatement.java:122) @ com.googlecode.flyway.core.dbsupport.jdbctemplate.execute(jdbctemplate.java:214) @ com.googlecode.flyway.core.dbsupport.mysql.mysqltable.dolock(mysqltable.java:58) @ com.googlecode.flyway.core.dbsupport.table.lock(table.java:254)
i'm confused because flyway docs says works on gae cloud sql , appenginedriver. maybe it's recent change either flyway or gae.
but here's fix.
after using jad @ gae's classes , tracing flyway, think sql statements such lock not supported rpc protocol used send queries between app engine server instance , mysql cluster.
so on whim, i've overridden mysqltable.java in flyway use simple statement instead of preparedstatement. no statement caching works.
i copied mysqltable.java on project keeping same packaging , replaced following:
@override protected void dolock() throws sqlexception { jdbctemplate.executestatement("lock tables " + + " write"); } @override protected void dounlock() throws sqlexception { jdbctemplate.executestatement("unlock tables"); }
executestatement instead of execute.
we waiting official fix.
regards,
remy
Comments
Post a Comment