gravitee-io / issues

Gravitee.io - API Platform - Issues
64 stars 26 forks source link

jdbc repository : error from Liquibase script on upgrade #8816

Closed apoddany closed 1 year ago

apoddany commented 1 year ago
    1. :collision: Describe the bug When attempting to upgrade APIM installation to last 3.18.17 or 3.19.6 with jdbc repository, the following error is raised :
 16:49:31.713 <span class="error">[graviteeio-node]</span> ERROR liquibase.changelog.ChangeSet - Change Set liquibase/changelogs/v3_15_20/schema.yml::3.15.20::GraviteeSource Team failed. Error: ERROR: could not create unique index "pk_flow_steps"
 Detail: Key (flow_id, "order", phase)=(c1e9d58d-a7c4-4577-a9d5-8da7c4d57730, 0, PRE) is duplicated. <span class="error">[Failed SQL: (0) ALTER TABLE apim_management.flow_steps ADD CONSTRAINT pk_flow_steps PRIMARY KEY (flow_id, "order", phase)]</span>
 16:49:31.729 <span class="error">[graviteeio-node]</span> WARN o.s.c.a.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcManagementRepositoryConfiguration': Initialization of bean failed; nested exception is io.gravitee.repository.jdbc.exception.DatabaseInitializationException: Failed to set up database
 16:49:31.744 <span class="error">[graviteeio-node]</span> ERROR i.g.p.c.i.PluginContextFactoryImpl - Unable to refresh plugin context
 ...
 Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase/changelogs/v3_15_20/schema.yml::3.15.20::GraviteeSource Team:
 Reason: liquibase.exception.DatabaseException: ERROR: could not create unique index "pk_flow_steps"
 Detail: Key (flow_id, "order", phase)=(c1e9d58d-a7c4-4577-a9d5-8da7c4d57730, 0, PRE) is duplicated. <span class="error">[Failed SQL: (0) ALTER TABLE apim_management.flow_steps ADD CONSTRAINT pk_flow_steps PRIMARY KEY (flow_id, "order", phase)]</span>
 at liquibase.changelog.ChangeSet.execute(ChangeSet.java:659)
 ...
 Caused by: liquibase.exception.DatabaseException: ERROR: could not create unique index "pk_flow_steps"
 Detail: Key (flow_id, "order", phase)=(c1e9d58d-a7c4-4577-a9d5-8da7c4d57730, 0, PRE) is duplicated. <span class="error">[Failed SQL: (0) ALTER TABLE apim_management.flow_steps ADD CONSTRAINT pk_flow_steps PRIMARY KEY (flow_id, "order", phase)]</span>
 at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:430)
 ...
    1. :sunrise_over_mountains: To Reproduce Steps to reproduce the behaviour: 1. perform an upgrade to 3.18.13 to 3.18.17 of an APIM installation with jdbc repository (here Postgresql 2. See error in the management-api logs

Please complete the following information:

    1. :warning: Potential impacts

Which other features may be impacted by this fix. This could be populated after fix

What are the impacted versions?

    1. :link: Dependencies

Link a story or other related things...

exalate-issue-sync[bot] commented 1 year ago

Lilia Enachi commented: Tested locally together with [~accountid:61aa2cf9ef18ca0071a56691]. The upgrade from 3.15.21 to 3.15.22 works as expected without any error