Liquidbase script error - 14.0 to 15.0 upgrade

Hi,

When attempting to run

to upgrade the CTA Catalogue from version 14.0 to 15.0 on our dev instance, our DBAs
encountered the following error

liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset 14.0-15.0.sql::3::kskovola:

Reason: liquibase.exception.DatabaseException: ORA-02290: check constraint (CTA.NO_SELF_SUPPLY_CK) violated

[Failed SQL: (2290) INSERT INTO TAPE_POOL_SUPPLY (SUPPLY_SOURCE_TAPE_POOL_ID, SUPPLY_DESTINATION_TAPE_POOL_ID)

Their finding was

This error occurred because the INSERT statement attempted to insert rows where SUPPLY_SOURCE_TAPE_POOL_ID = SUPPLY_DESTINATION_TAPE_POOL_ID, which violates the check constraint NO_SELF_SUPPLY_CK.

To resolve the error, they added immedialy after line 56 of the script the following clause

WHERE s2.supply_src_id != s2.supply_dest_id

Can you please comment on this error and let us know if the above script correction is appropriate?

Thanks,

George

Hi George,

This error most probably happened because one of your tape pools is referencing itself as supply (in the SUPPLY column of the TAPE_POOL table).

You should be able to find it with the command cta-admin tp ls.

That column had a few problems (it did not comply with basic DB normal forms), so in CTA Catalogue version 15.0 we have a new table TAPE_POOL_SUPPLY that is meant to replace it. More information can be found on this issue:

Regarding your proposed solution, it should work.

However I suggest simply removing the self-reference, by setting a new supply string with the cta-admin tp ch --name/-n <tapepool_name> --supply/-s <supply_value> command.

This way, all data in the DB remains consistent.

Best,
Joao

Hi Joao,

Many thanks for the explanation! Indeed, this was exactly the case with the freeIR pool shown below

name         vo #tapes #partial #phys files size used avail  use% encrypt supply    c.user      c.host           c.time    m.user      m.host           m.time   
clf_test facilities      1        1          46 9.0T 1.6T  7.4T 17.5%   false freeIR cta-admin cta-front02 2022-08-01 17:14 cta-admin cta-front02 2022-10-04 13:33 anape pool
  freeIR facilities      0        1           0    0    0     0  0.0%   false      - cta-admin cta-front02 2022-10-04 13:31 cta-admin cta-front02 2022-10-04 13:31 anee LTO tapes for check_tape_pools

One of us accidentally created on the dev instance the freeIR pool within the same VO as the pool which has it a supply sourc, i.e. ‘clf_test’. I am pretty sure that this is not happening either on our preprod or prod instances where all supply pools have been created within a seperate VO called free.

Best,

George