Connectrix: Database migration fails when upgrading to CMCNE 14.4.3 and rolls back to previous version.[1]

           

   Article Number:     531669                                   Article Version: 3     Article Type:    Break Fix 
   

 


Product:

 

Connectrix Manager Converged Network Edition

 

Issue:

 

 

When upgrading to CMCNE 14.4.3, the installation stage successfully completes.   
   
    But afterwards, the database migration stage fails with the below error message:   
   
    Migration_Failure_Error.jpg
                                                           

 

 

Cause:

 

 

   

      When migrating the DB data, there is an issue inserting an entry into 'ach_event' with a duplicate key.     
     
      For this reason, the DB migration fails and rolls back to its previous version.   

                                                             

 

 

Change:

 

 

The following will be found in the PostgreSQL log file at the time of the migration failure:    

2018-09-11 07:36:40.037 MDT {[unknown]} [6208:3-1] ERROR:  duplicate key value violates unique constraint "pk_eventid" 2018-09-11 07:36:40.037 MDT {[unknown]} [6208:4-1] DETAIL:  Key (id)=(99) already exists. 2018-09-11 07:36:40.037 MDT {[unknown]} [6208:5-1] STATEMENT:  --  1     
            -- Migration SQL that makes the change goes here.    
            insert into ach_event(reason_code,fru_code,description,severity,type) values('1991161','IP161','Loop detection error',1,'IOS')    
   
    And the below line will be found in the "migrateschema.log":   
   
    Error executing: --  1    
    -- Migration SQL that makes the change goes here.    
    insert into ach_event(reason_code,fru_code,description,severity,type) values('1991161','IP161','Loop detection error',1,'IOS');    
    .  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_eventid"    
      Detail: Key (id)=(99) already exists.   
    ERROR: Error executing command.  Cause: org.apache.ibatis.jdbc.RuntimeSqlException: Error executing: --  1    
    -- Migration SQL that makes the change goes here.    
    insert into ach_event(reason_code,fru_code,description,severity,type) values('1991161','IP161','Loop detection error',1,'IOS');    
    .  Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_eventid"    
      Detail: Key (id)=(99) already exists.    
    "migrate up script invocation completed "                                                            

 

 

Resolution:

 

 

After installing the new CMCNE version, you will be prompted with the option to migrate your data from your old CMCNE version (shown below):   
    Migration_Prompt_Image   
   
    1. At this stage, and before you choose to migrate your data to 14.4.3, please perform the steps outlined below.   
   
    2. Edit and replace the below lines in <CMCME_Home>\conf\schema\dcm-postgres-schema.sql    
   
    insert into ACH_EVENT(reason_code,fru_code,description,severity,type) values('1991161','IP161','Loop detection error',1,'IOS');    
   
    Replace the above line with the below one.   
   
    insert into ach_event values(166,'1991161','IP161','Loop detection error',1,'IOS', '');    
   
   
    3. Edit and replace the below lines in <CMCNE_Home>\conf\schema\migrate\scripts\20180605110213_1.sql    
   
    insert into ACH_EVENT(reason_code,fru_code,description,severity,type) values('1991161','IP161','Loop detection error',1,'IOS');    
   
    Replace the above line with below one.   
   
    insert into ach_event values(166,'1991161','IP161','Loop detection error',1,'IOS', '');    
   
   
    4. Continue the migration.