You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
apanicker-nflx
merged 4 commits into
Netflix:dev
from
michaelpaliy:bugFix/flywayMigrationConflictsApr 5, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi,
Our conductor setup consists of multiple instances. If we start the instances simultaneously, sometimes we got the following error:
2021-02-01 12:42:08,339 [main] ERROR error migration DB
org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException:
Script failed
-------------
SQL State : 23505
Error Code : 0
Message : ERROR: duplicate key value violates unique constraint "pg_type_typname_nsp_index"
Detail: Key (typname, typnamespace)=(schema_version, 2200) already exists.
Line : 17
Statement : CREATE TABLE "public"."schema_version" (
"installed_rank" INT NOT NULL,
"version" VARCHAR(50),
"description" VARCHAR(200) NOT NULL,
"type" VARCHAR(20) NOT NULL,
"script" VARCHAR(1000) NOT NULL,
"checksum" INTEGER,
"installed_by" VARCHAR(100) NOT NULL,
"installed_on" TIMESTAMP NOT NULL DEFAULT now(),
"execution_time" INTEGER NOT NULL,
"success" BOOLEAN NOT NULL
) WITH (
OIDS=FALSE
)
at org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:117)
at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.createIfNotExists(MetaDataTableImpl.java:104)
at org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.lock(MetaDataTableImpl.java:111)
at org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:175)
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 com.netflix.conductor.postgres.PostgresDataSourceProvider.flywayMigrate(PostgresDataSourceProvider.java:94)
at com.netflix.conductor.postgres.PostgresDataSourceProvider.get(PostgresDataSourceProvider.java:43)
at com.netflix.conductor.postgres.PostgresDataSourceProvider.get(PostgresDataSourceProvider.java:28)
I am a couple of dev versions behind so maybe it is because of that but I made the same changes in the Postgres module and I get this error at startup (we have a schema named conductor-unita in our 'unit' database):
[ERROR] 2021-02-02 14:24:31,388 PostgresDataSourceProvider - error migration DB
org.flywaydb.core.api.FlywayException: Found non-empty schema(s) "conductor_unita" but no schema history table. Use baseline() or set baselineOnMigrate to true to initialize the schema history table.
at org.flywaydb.core.Flyway$1.execute(Flyway.java:196)
Hi @rickfish
Thanks for the review.
Flyway changed the default schema history table name from schema_version to flyway_schema_history.
So, it's not recognized your history table and you got an error.
I updated the configurations to use schema_version as default.
can you pls try to run it again with the new commit?
Hi @apanicker-nflx / @aravindanr,
Could you pls review and merge this PR?
This issue blocking us, and force us to work with a forked repo.
We have a requirement to destroy and deploy new conductor clusters which consist of multiple instances,
When we deploy a new cluster with an empty database we get the following error:
ERROR: duplicate key value violates unique constraint "pg_type_typname_nsp_index"
This PR fixes this issue, by updating the flyway version (which causes this bug).
* update flyway version
* set FLYWAY_TABLE_DEFAULT_VALUE to schema_history
* update flyway version
Co-authored-by: michaelpa <michael.paliy@niceactimize.com>
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
Our conductor setup consists of multiple instances. If we start the instances simultaneously, sometimes we got the following error:
This issue is related to flyway (conductor is using flyway:4.0.3, this issue is fixed in 5.1.0):
flyway/flyway#1067
flyway/flyway#1983
In this PR, I updated the flyway version to the latest one which solves this issue.