NetBackup Snapshot Manager 10.3.x or higher upgrade fails during DB Migration as the database contains references from Cloudpoint 2.x Version.
Problem
NetBackup Snapshot Manager 10.3.x or higher upgrade fails during DB Migration as the database contains references from Cloudpoint 2.x Version.
Error Message
Error during the upgrade:
Starting container: flexsnap-postgresql ...done
Waiting for flexsnap-postgresql container to move to healthy state...Starting container: flexsnap-mongodb ...done
Waiting for flexsnap-mongodb container to move to healthy state...Data migration required from mongo database to postgresql database
Data migration is failed.
For more information, refer to the /cloudpoint/logs/flexsnap.log file.
flexsnap-cloudpoint.log:
Traceback (most recent call last):
File "/opt/VRTScloudpoint/bin/flexsnap-dbmigrate.py", line 71, in <module>
raise exception
File "/opt/VRTScloudpoint/bin/flexsnap-dbmigrate.py", line 67, in <module>
db_migration.database_migration()
File "/opt/VRTScloudpoint/lib/flexsnap/database/data_migration.py", line 79, in database_migration
raise e
File "/opt/VRTScloudpoint/lib/flexsnap/database/data_migration.py", line 65, in database_migration
self.__migrate_table_data(mongo_table_conn, postgres_table_conn, table)
File "/opt/VRTScloudpoint/lib/flexsnap/database/data_migration.py", line 93, in __migrate_table_data
postgres_table_conn.insert(data)
File "/opt/VRTScloudpoint/lib/flexsnap/database/postgresql/operations.py", line 80, in _func
raise flexsnap.OperationFailed(str(e))
flexsnap.OperationFailed: column "rules" is of type jsonb but expression is of type text[]
LINE 3: VALUES (ARRAY['{"source": "aws-regio...
^
HINT: You will need to rewrite or cast the expression.
Cause
The issue with the database migration stems from legacy references from the previous CloudPoint 2.x system, which were incrementally upgraded to newer versions of CloudPoint and NetBackup Snapshot Manager. These outdated references are no longer supported in versions 10.3 and higher, due to which migration fails.
Solution
Note: Before running the commands below, make sure the system is recovered to the version from which the upgrade was attempted. Also create a tar of /cloudpoint.
To resolve the issue, there is a need to remove the information from MongoDB:
Docker:
- Login to flexsnap-mongodb using - docker exec -it flexsnap-mongodb bash
Podman:
- Login to flexsnap-mongodb using - podman exec -it flexsnap-mongodb bash
After login, follow the steps below to do cleanup:
- Run "mongo --host flexsnap-mongodb --ssl --sslCAFile /cloudpoint/keys/cacert.pem --sslPEMKeyFile /cloudpoint/keys/mongodb.pem" command to login to the database.
- Run use flexsnap command to switch to db flexsnap. On successful execution,
switched to db flexsnap
will be displayed. - Run db.repl_policy.drop() command to do the cleanup. On successful execution,
true
message will be displayed. - Exit the database and container using Exit command.
NOTE: If the system was originally on CloudPoint 2.x and underwent subsequent upgrades, please review the relevant article section to ensure that any potential issues related to these legacy versions are addressed and mitigated during the upgrade process.