We're updating the issue view to help you get more done. 

Cannot start up auth service when migrating to 3.4 RC

Description

Get an error when migrating to latest 3.4 code on perftest with MW dataset.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 Caused by: org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException: Migration 20180613120215847__remove_referencedatauserid_from_user.sql failed ---------------------------------------------------------------------------- SQL State : 23503 Error Code : 0 Message : ERROR: update or delete on table "auth_users" violates foreign key constraint "fk_la2ts67g4oh2sreayswhox1i6" on table "password_reset_tokens" Detail: Key (id)=(da5e15f0-e3a6-4104-9db0-02d3806e6ae1) is still referenced from table "password_reset_tokens". Location : db/migration/20180613120215847__remove_referencedatauserid_from_user.sql (/file:/service.jar!/BOOT-INF/classes!/db/migration/20180613120215847__remove_referencedatauserid_from_user.sql) Line : 1 Statement : UPDATE auth_users SET id = referencedatauserid at org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:117) at org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:71) at org.flywaydb.core.internal.command.DbMigrate.doMigrate(DbMigrate.java:352) at org.flywaydb.core.internal.command.DbMigrate.access$1100(DbMigrate.java:47) at org.flywaydb.core.internal.command.DbMigrate$4.doInTransaction(DbMigrate.java:308) at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72) at org.flywaydb.core.internal.command.DbMigrate.applyMigration(DbMigrate.java:305) at org.flywaydb.core.internal.command.DbMigrate.access$1000(DbMigrate.java:47) at org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:230) at org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:173) at org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72) at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:173) at org.flywaydb.core.Flyway$1.execute(Flyway.java:959) at org.flywaydb.core.Flyway$1.execute(Flyway.java:917) at org.flywaydb.core.Flyway.execute(Flyway.java:1373) at org.flywaydb.core.Flyway.migrate(Flyway.java:917) at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579) ... 26 common frames omitted Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "auth_users" violates foreign key constraint "fk_la2ts67g4oh2sreayswhox1i6" on table "password_reset_tokens" Detail: Key (id)=(da5e15f0-e3a6-4104-9db0-02d3806e6ae1) is still referenced from table "password_reset_tokens". at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2412) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2125) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:297) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:428) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:354) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:301) at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:287) at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:264) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:260) at org.flywaydb.core.internal.dbsupport.JdbcTemplate.executeStatement(JdbcTemplate.java:238) at org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:114) ... 44 common frames omitted

Looks like foreign key issue in migration script, when there is data in password_reset_tokens.

Environment

None

Status

Assignee

Łukasz Lewczyński

Reporter

Chongsun Ahn

Labels

None

Story Points

2

Time tracking

24h

Components

Sprint

None

Fix versions

Priority

Critical