Portal Fails To Start After Upgrading To 4.5

book

Article ID: 195123

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

After performing an upgrade from Portal version 4.3.x or lower to Portal 4.4 or 4.5 and attempting to start the portal components by running the portal.sh script we see that things hang at the following point:

Creating Service portal_db-upgrade
Creating Service portal_db-upgrade-rbac
Checking to see if DB schema update is needed........................................................................................
.....................................................................................................................................
.....................................................................................................................................

 

If we look at the portal_db-upgrade log via 'docker service logs portal-db-upgrade' we will see
the following kinds of messages:

Change Set doesntmatter::onprem-migrate-legacy-swagger-from-api-to-api_asset::bagjo04 failed.  Error: Column 'NAME' cannot be null [Failed SQL: INSERT INTO `API_ASSET` (

Unexpected error running Liquibase: Column 'NAME' cannot be null [Failed SQL: INSERT INTO `API_ASSET`

Cause

This situation occurs if there is any api information within the portal database where the spec_filename column is 'NULL'.

If we were to execute the following kind of query on the portal database

select name, uuid, spec_filename from API where spec_content is not null order by spec_filename;

In the results returned we could see that there were indeed entries where the spec_filename column did not
have any file name associated with it and it was 'NULL'.

Environment

Portal 4.4 or 4.5

Resolution

To avoid this situation please do the following either prior to upgrading to portal version 4.4 or 4.5 or if you encounter the problem after having gone through the upgrade already and you are now experiencing this problem:

1. Run the query below on the portal db:
SELECT count(*) from API WHERE SPEC_CONTENT IS NOT NULL and (SPEC_FILENAME IS NULL OR SPEC_FILENAME = 'NULL');

If it returns > 0 results, then run either 2.(mysql DB) or 3.(postgreasql)


2. <<MYSQL>>
UPDATE API INNER JOIN 
(SELECT TENANT_ID, UUID FROM API WHERE SPEC_CONTENT IS NOT NULL and (SPEC_FILENAME IS NULL OR SPEC_FILENAME = 'NULL')) tbl
ON API.TENANT_ID = tbl.TENANT_ID AND API.UUID = tbl.UUID
SET SPEC_FILENAME = 'swagger.json';

 

3. <<postgresql>>
UPDATE API SET SPEC_FILENAME = 'swagger.json' WHERE (TENANT_ID, UUID) IN (SELECT TENANT_ID, UUID FROM API WHERE SPEC_CONTENT IS NOT NULL and (SPEC_FILENAME IS NULL OR SPEC_FILENAME = 'NULL'));

-If you encounter this problem after having attempted to upgrade the portal then you will also need to restart the portal once more after running the above query:

docker stack rm portal

<PortalInstallDirectory>/portal.sh

Additional Information

Our development team is looking into creating a fix to be included in a future CR or release to address this situation.