No enum constant liquibase.changelog.ChangeSet.ExecType.MARK\_RAN

Leif Neland4 years ago

I'm trying to run traccar with mariadb in docker on a new installation

Initially I had the new traccar (image traccar:latest) running on the h2 database, with no old data,
I then switched to mysql, having converted the h2 to mysql with a modified version of https://github.com/pedromartins4/H2-to-MySQL

But traccar stops with this;

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: No enum constant liquibase.changelog.ChangeSet.ExecType.MARK\_RAN
    at org.traccar.Main.run(Main.java:152)
    at org.traccar.Main.main(Main.java:104)
Caused by: java.lang.IllegalArgumentException: No enum constant liquibase.changelog.ChangeSet.ExecType.MARK\_RAN
    at java.lang.Enum.valueOf(Enum.java:238)
    at liquibase.changelog.ChangeSet$ExecType.valueOf(ChangeSet.java:56)
    at liquibase.changelog.StandardChangeLogHistoryService.getRanChangeSets(StandardChangeLogHistoryService.java:343)
    at liquibase.changelog.AbstractChangeLogHistoryService.upgradeChecksums(AbstractChangeLogHistoryService.java:66)
    at liquibase.changelog.StandardChangeLogHistoryService.upgradeChecksums(StandardChangeLogHistoryService.java:297)
    at liquibase.Liquibase.checkLiquibaseTables(Liquibase.java:1234)
    at liquibase.Liquibase.update(Liquibase.java:193)
    at liquibase.Liquibase.update(Liquibase.java:179)
    at liquibase.Liquibase.update(Liquibase.java:175)
    at org.traccar.database.DataManager.initDatabaseSchema(DataManager.java:312)
    at org.traccar.database.DataManager.<init>(DataManager.java:90)
    at org.traccar.Context.init(Context.java:292)
    at org.traccar.Main.run(Main.java:110)
    ... 1 more
Anton Tananaev4 years ago

Looks like there's some issue with Liquibase changelog table.

Leif Neland4 years ago

I only have these tables:

+------------------------+
| Tables_in_traccar      |
+------------------------+
| DATABASECHANGELOG      |
| DATABASECHANGELOGLOCK  |
| TC_ATTRIBUTES          |
| TC_CALENDARS           |
| TC_COMMANDS            |
| TC_DEVICES             |
| TC_DEVICE_ATTRIBUTE    |
| TC_DEVICE_COMMAND      |
| TC_DEVICE_DRIVER       |
| TC_DEVICE_GEOFENCE     |
| TC_DEVICE_MAINTENANCE  |
| TC_DEVICE_NOTIFICATION |
| TC_DRIVERS             |
| TC_EVENTS              |
| TC_GEOFENCES           |
| TC_GROUPS              |
| TC_GROUP_ATTRIBUTE     |
| TC_GROUP_COMMAND       |
| TC_GROUP_DRIVER        |
| TC_GROUP_GEOFENCE      |
| TC_GROUP_MAINTENANCE   |
| TC_GROUP_NOTIFICATION  |
| TC_MAINTENANCES        |
| TC_NOTIFICATIONS       |
| TC_POSITIONS           |
| TC_SERVERS             |
| TC_STATISTICS          |
| TC_USERS               |
| TC_USER_ATTRIBUTE      |
| TC_USER_CALENDAR       |
| TC_USER_COMMAND        |
| TC_USER_DEVICE         |
| TC_USER_DRIVER         |
| TC_USER_GEOFENCE       |
| TC_USER_GROUP          |
| TC_USER_MAINTENANCE    |
| TC_USER_NOTIFICATION   |
| TC_USER_USER           |
+------------------------+
38 rows in set (0.002 sec)

Is it this table?

MariaDB [traccar]> show  fields from DATABASECHANGELOG;
+---------------+--------------+------+-----+----------------------+--------------------------------+
| Field         | Type         | Null | Key | Default              | Extra                          |
+---------------+--------------+------+-----+----------------------+--------------------------------+
| ID            | text         | NO   |     | NULL                 |                                |
| AUTHOR        | text         | NO   |     | NULL                 |                                |
| FILENAME      | text         | NO   |     | NULL                 |                                |
| DATEEXECUTED  | timestamp(6) | NO   |     | current_timestamp(6) | on update current_timestamp(6) |
| ORDEREXECUTED | int(10)      | NO   |     | NULL                 |                                |
| EXECTYPE      | text         | NO   |     | NULL                 |                                |
| MD5SUM        | text         | YES  |     | NULL                 |                                |
| DESCRIPTION   | text         | YES  |     | NULL                 |                                |
| COMMENTS      | text         | YES  |     | NULL                 |                                |
| TAG           | text         | YES  |     | NULL                 |                                |
| LIQUIBASE     | text         | YES  |     | NULL                 |                                |
| CONTEXTS      | text         | YES  |     | NULL                 |                                |
| LABELS        | text         | YES  |     | NULL                 |                                |
| DEPLOYMENT_ID | text         | YES  |     | NULL                 |                                |
+---------------+--------------+------+-----+----------------------+--------------------------------+
14 rows in set (0.002 sec)

First row:

MariaDB [traccar]> select * from DATABASECHANGELOG order by DATEEXECUTED desc limit 1;
+---------------+--------+---------------+----------------------------+---------------+----------+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------+-----------+----------+--------+---------------+
| ID            | AUTHOR | FILENAME      | DATEEXECUTED               | ORDEREXECUTED | EXECTYPE | MD5SUM | DESCRIPTION                                                                                                                                                                                                                                                     | COMMENTS | TAG  | LIQUIBASE | CONTEXTS | LABELS | DEPLOYMENT_ID |
+---------------+--------+---------------+----------------------------+---------------+----------+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------+-----------+----------+--------+---------------+
| changelog-3.3 | author | changelog-3.3 | 2020-06-29 02:36:59.701785 |             1 | EXECUTED | NULL   | createTable tableName=users; addUniqueConstraint constraintName=uk\_user\_email, tableName=users; createTable tableName=devices; addUniqueConstraint constraintName=uk\_device\_uniqueid, tableName=devices; createTable tableName=user\_device; addForeignK... |          | NULL | 3.5.3     | NULL     | NULL   | 1680654364    |
+---------------+--------+---------------+----------------------------+---------------+----------+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+------+-----------+----------+--------+---------------+
1 row in set (0.001 sec)
Leif Neland4 years ago

Strange, I got it running by adding the driver:local to the list of volumes:

volumes:
 traccar-db:
   driver: local
 traccar-mysql:
    driver: local

BUT! it seems like when I use the H2-to-MySQL converter, all the table names are in upper case,
When I starts traccar it deletes the uppercase tables and creates an empty set of lowercase tables.
I guess I should lowercase the table names.
Should the field names be lowercased too?

Anton Tananaev4 years ago

You need to make sure names are treated as case-insensitive.

Leif Neland4 years ago

I finally got it running.
I started the new server, and let it create a fresh empty mysql db,

Then modified the H2-to-mysql to REPLACE INTO the data from H2 to MySql (and lowercasing table and column names)

Now I just wonder how long it will take for the clients (gps-devices) to look up the new IP for the new server.

Wenyu Shi2 years ago

I know this is after 2 years... but I recently came across with the same issue. The EXECTYPE is a field of Liquibase's table DATABASECHANGELOG, see the doc here https://docs.liquibase.com/concepts/tracking-tables/databasechangelog-table.html
EXECTYPE VARCHAR(10) Description of how the changeset was executed. Possible values include EXECUTED, FAILED, SKIPPED, RERAN, and MARK_RAN.
In your case, you had a backsplash in that field MARK_RAN, and that's why Liquibase errored out.
As for where did that unwanted backsplash come from, that probably takes a bit peek into the DATABASECHANGELOG table. In my case, the error stated No enum constant liquibase.changelog.ChangeSet.ExecType.3.5.3, wherein the numeric isn't among the accepted values for this field and I did find that numeric in the table. Removing that row eliminated the error immediately but broke other stuff - of course that's another story and issue that needs to be addressed. All to say it needs to be find out where the "MARK_RUN" resides. And this also echoes why it worked out for you when you destroyed the old database and started over with a clean slate - because the bad data was wiped out.