EUM upgrade from a version lower than 4.4 fails in the schema update step with the below error:
Unexpected error running Liquibase: Error executing SQL CREATE TABLE eum_db.crash_alert_events (hash_key VARCHAR(128) NOT NULL, range_key VARCHAR(128) NOT NULL, application_key VARCHAR(128) NOT NULL, alert_minute BIGINT(19) NOT NULL, group_id VARCHAR(128) NOT NULL, threshold INT(19) NOT NULL): Table 'crash_alert_events' already exists
For versions prior to 4.4, EUM has its database schema with Controller MySQL. Starting 4.4, EUM has its own database for a production mode. Hence, for a production mode installation, it is required to export the schema from the Controller database to the EUM MySQL database.
The EUM schema in 4.4 has some additional tables. When we import the dump as per the documented process, it drops the
eum_db schema in MySQL of EUM and then imports the dump from the previous version. The update-schema then creates the tables that were missing in the previous version of schema.
If we are not using the recommended command to take the export, the tables that are different from the dump are not dropped during the import. Therefore, when we run the
eum-schema update command, it fails with the above error. For example, we can take the database export using the below command as well:
./mysqldump -u root --password --protocol=TCP -P 3388 eum_db --add-drop-database > eum_db.sql
However, when we use this dump to import, it does not have drop syntax for the eum_db schema, which poses a problem during the update-schema command.
To avoid any anomalies during the upgrade process, we need to use the specified commands for taking the dump like below:
./mysqldump -u root --password --protocol=TCP -P [Controller-MySQL-Port] --databases eum_db --add-drop-database > eum_db.sql
This will ensure that the
eum_db schema is cleared before importing the dump and the
eum-schema update will run without issues.