I’m upgrading EUM from a version lower than 4.4. Why does the upgrade fail during “schema update”?
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
In versions prior to v4.4, the EUM database schema uses Controller MySQL. Starting with v4.4, EUM has its own database for a production mode. So, for a production mode installation, you must export the schema from the Controller database into the EUM MySQL database.
The EUM schema in v4.4 has some additional tables. When we import the dump using 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 schema version.
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, use the specified commands for taking the dump, as 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 that the
eum-schema update will run without issues.