Portal 5.2.1 Helm Upgrade fails with database upgrade when migrating to MariaDB
search cancel

Portal 5.2.1 Helm Upgrade fails with database upgrade when migrating to MariaDB

book

Article ID: 263446

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

We have an API dev portal v5.2.0.1 and tried to perform an upgrade using the latest version 5.2.1 of the file values.yaml.

(https://github.com/CAAPIM/apim-charts/tree/stable/charts/portal#layer7-api-developer-portal)

But I am getting an error when I try to run a helm upgrade at the "db upgrade" step:

upgrade.go:367: [debug] warning: Upgrade "portal" failed: pre-upgrade hooks failed: job failed: BackoffLimitExceeded
Error: UPGRADE FAILED: pre-upgrade hooks failed: job failed: BackoffLimitExceeded
helm.go:84: [debug] pre-upgrade hooks failed: job failed: BackoffLimitExceeded
UPGRADE FAILED

When I checked the DB upgrade job, I found the below error:

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set doesntmatter::enable-crypto-maria::konve04:
Reason: liquibase.exception.DatabaseException: FUNCTION AES_DECRYPT_PORTAL already exists [Failed SQL: (1304) CREATE FUNCTION AES_DECRYPT_PORTAL(encrypted TINYINT(4), aes_key VARCHAR(255), aes_salt VARCHAR(255), encrypted_value TEXT)
RETURNS VARCHAR(255)
LANGUAGE SQL
DETERMINISTIC
BEGIN
RETURN case when encrypted = 1 then AES_DECRYPT(UNHEX(encrypted_value), CONCAT(aes_key,aes_salt)) else encrypted_value end;
END]
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:672)

We also moved the portal database from MySql to MariaDB.

Environment

Release : 5.2.1

Resolution

This issue occurred because you migrated the portal db to MariaDB and upgraded portal to 5.2.1 which has support for MariaDB

The error in the database upgrade pod is indicating it tries to install a MariaDB specific changeset for the AES_DECRYPT function.

The database was created in MySQL so the function exists already but in MySQL format .

To work around this in the scenario where you moved a existing MySQL portaldb to MariaDB ,you have to drop the function and let the db_upgrade recreate it in MariaDB during the upgrade .