{"action":"created","issue":{"url":"https://api.github.com/repos/flyway/flyway/issues/1778","repository_url":"https://api.github.com/repos/flyway/flyway","labels_url":"https://api.github.com/repos/flyway/flyway/issues/1778/labels{/name}","comments_url":"https://api.github.com/repos/flyway/flyway/issues/1778/comments","events_url":"https://api.github.com/repos/flyway/flyway/issues/1778/events","html_url":"https://github.com/flyway/flyway/issues/1778","id":260129010,"number":1778,"title":"Parallel Migration Issue","user":{"login":"rameezrajas","id":19847319,"avatar_url":"https://avatars2.githubusercontent.com/u/19847319?v=4","gravatar_id":"","url":"https://api.github.com/users/rameezrajas","html_url":"https://github.com/rameezrajas","followers_url":"https://api.github.com/users/rameezrajas/followers","following_url":"https://api.github.com/users/rameezrajas/following{/other_user}","gists_url":"https://api.github.com/users/rameezrajas/gists{/gist_id}","starred_url":"https://api.github.com/users/rameezrajas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rameezrajas/subscriptions","organizations_url":"https://api.github.com/users/rameezrajas/orgs","repos_url":"https://api.github.com/users/rameezrajas/repos","events_url":"https://api.github.com/users/rameezrajas/events{/privacy}","received_events_url":"https://api.github.com/users/rameezrajas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-25T00:48:15Z","updated_at":"2017-11-14T17:10:16Z","closed_at":null,"author_association":"NONE","body":"###### What version of Flyway are you using?\r\n4.2.0\r\n\r\n\r\n###### Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)\r\nMaven Plugin\r\n\r\n\r\n\r\n\r\n###### What database are you using (type & version)?\r\nMicrosoft SQL Server 2016\r\n\r\n\r\n\r\n###### What operating system are you using?\r\nLinux \r\n\r\n\r\n###### What did you do?\r\n(Please include the content causing the issue, any relevant configuration settings, and the command you ran)\r\nFlyway is executing same migration when I have two instances of my application startup nearly simultaneously while pointing at an empty database \r\nFirst instance of service successfully executes all migration\r\nSecond instance of service starts executing the migrations from the middle\r\n\r\nInstance 1\r\n{\"timeMillis\":1506297752742,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.util.VersionPrinter\",\"message\":\"Flyway 4.2.0 by Boxfuse\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753615,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.callback.SqlScriptFlywayCallback\",\"message\":\"Executing SQL callback: beforeMigrate\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753643,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.metadatatable.MetaDataTableImpl\",\"message\":\"Creating Metadata table: [dbo].[schema_version]\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753706,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Current version of schema [dbo]: << Empty Schema >>\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753720,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.1 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753844,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.2 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753884,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.3 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753923,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.4 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753952,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.5 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297753998,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.6 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754026,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.7 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754065,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.8 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754100,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.9 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754134,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.10 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754161,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.11 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754192,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.12 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754219,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.13 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754334,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.15 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754375,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.16 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754403,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.17 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n\r\nInstance 2\r\n\r\n{\"timeMillis\":1506297753350,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.util.VersionPrinter\",\"message\":\"Flyway 4.2.0 by Boxfuse\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754202,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.callback.SqlScriptFlywayCallback\",\"message\":\"Executing SQL callback: beforeMigrate\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754305,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Current version of schema [dbo]: 1.13\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754308,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.14 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754351,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migrating schema [dbo] to version 1.15 - XXXXX SCRIPT\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754357,\"thread\":\"main\",\"level\":\"ERROR\",\"loggerName\":\"org.flywaydb.core.internal.command.DbMigrate\",\"message\":\"Migration of schema [dbo] to version 1.15 - XXXXX SCRIPT failed! Changes successfully rolled back.\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754358,\"thread\":\"main\",\"level\":\"INFO\",\"loggerName\":\"org.flywaydb.core.internal.dbsupport.sqlserver.SQLServerDbSupport\",\"message\":\"SQLServer does not support setting the schema for the current session. Default schema NOT changed to dbo\",\"endOfBatch\":false,\"loggerFqcn\":\"org.apache.logging.slf4j.Log4jLogger\",\"contextMap\":{\"appName\":\"product\"},\"threadId\":1,\"threadPriority\":5}\r\n{\"timeMillis\":1506297754359,\"thread\":\"main\",\"level\":\"WARN\",\"loggerName\":\"org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext\",\"message\":\"Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateSqlException: \\nMigration V1_15__XXXX_SCRIPT.sql failed\\n-----------------------------------------------------\r\n\r\n\r\n###### What did you expect to see?\r\nIf one instance of service is process of migrating the schema, the other instance of service should wait for the migration to be finished by first service. Locking is missing\r\n\r\n\r\n###### What did you see instead?\r\nTwo instances of service executing same migration\r\n"},"comment":{"url":"https://api.github.com/repos/flyway/flyway/issues/comments/344328889","html_url":"https://github.com/flyway/flyway/issues/1778#issuecomment-344328889","issue_url":"https://api.github.com/repos/flyway/flyway/issues/1778","id":344328889,"user":{"login":"axelfontaine","id":684824,"avatar_url":"https://avatars2.githubusercontent.com/u/684824?v=4","gravatar_id":"","url":"https://api.github.com/users/axelfontaine","html_url":"https://github.com/axelfontaine","followers_url":"https://api.github.com/users/axelfontaine/followers","following_url":"https://api.github.com/users/axelfontaine/following{/other_user}","gists_url":"https://api.github.com/users/axelfontaine/gists{/gist_id}","starred_url":"https://api.github.com/users/axelfontaine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axelfontaine/subscriptions","organizations_url":"https://api.github.com/users/axelfontaine/orgs","repos_url":"https://api.github.com/users/axelfontaine/repos","events_url":"https://api.github.com/users/axelfontaine/events{/privacy}","received_events_url":"https://api.github.com/users/axelfontaine/received_events","type":"User","site_admin":false},"created_at":"2017-11-14T17:10:16Z","updated_at":"2017-11-14T17:10:16Z","author_association":"CONTRIBUTOR","body":"This is very surprising as we actually have code to handle this exact scenario. Can you share a small test to reproduce this?"}}
{"actor":{"display_login":"axelfontaine"}}