Failed to update database to latest schema
Original Question or Issue:
After upgrading FileCloud Server to v23.252, the System > Checks page in the Admin Portal shows FileCloud DB Version 91 and that the Schema failed to update
Environment:
- Product - FileCloud Server
- Version - 23.252
- Platform - Windows
Steps to Reproduce:
- Upgrade FileCloud Server to the latest version (v23.252)
- Access the Admin Portal and navigate to System > Checks to check the FileCloud DB Version and if an update is required
Error or Log Message:
- ... from the customer side:
http://<url>/Install page displays:
"An internal error occurred while processing your request" - ... from the test environment where the /install page was accessible:
"Failed to update database to latest version" - ... from the FileCloud Server Logs:
YYYY-MM-DD 10:49:55.884910 ERROR: [4116][17624441903975] Failed adding ITAR and/or CUI metadata set: Exception: Metadata set definition already exists
YYYY-MM-DD 11:02:43.727096 ERROR: [4116][17624449635228] Failed adding ITAR and/or CUI metadata set: Exception: Search pattern with name ITAR 1 already exists
Defect or Enhancement Number:
Cause:
- The http://<url>/install page was inaccessible due to the '\install' folder not being present inside the C:\xampp\htdocs on the FileCloud Server as expected
- The Database Schema was failing to update because of particular classification rules, search pattern groups, search patterns, and metadata set definitions getting stuck during the process
Resolution or Workaround:
- The FileCloud Server was updated after a minimum version update, which regenerated the \install folder in it's rightful location (C:\xampp\htdocs).
(NOTE: A default \install folder can be sent in these scenarios if it does not exist) - The stuck classification rules, search pattern groups, search patterns, and metadata set definitions were removed with the following commands:
mongosh (connect into the Mongo shell)
use tonidclouddb (use the proper database)
db.content_classification_rules.deleteMany({ name: /ITAR/i });
db.searchpattern_group.deleteMany({ name: /ITAR/i });
db.searchpattern_group.deleteMany({ name: /CUI/i });
db.searchpattern.deleteMany({ name: /ITAR/i });
db.searchpattern.deleteMany({ name: /CUI BASIC/i });
db.searchpattern.deleteMany({ name: /CUI SPECIFIED/i });
db.metadata_set_definitions.deleteOne({ _id: ObjectId("Logs show this Object ID") });
db.metadata_set_definitions.deleteOne({ _id: ObjectId("Logs show this Object ID") });
- NOTE: It's important to delete the 'metadata_set_definitions' last in this process.
- After successfully deleting the entries, re-visit the http://<url>/install page again > Extended Checks > Update the Database Schema
Notes:
Upon successful login to the Admin Portal, the system will attempt a DB schema update if it's needed