Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG] On MySQL, table checks see other databases on the same login, so a second OIE database never gets its schema

Aperta
#489 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
java, mysql
Ambito
databases

Direzione di ricerca

Start in DatabaseUtil.tableExists (server/.../util/DatabaseUtil.java) and JdbcDao.tableExists and checkAndCreateChannelTables (donkey/.../jdbc/JdbcDao.java), where getTables(null, null, ...) is called with no catalog. The fix is probably to pass the connection's current catalog, then check that ServerMigrator.initDatabase (around line 260) starts against a second database on the same login. Done means engine B on oie_b creates its schema and recreates a dropped D_MC1 on a shared MySQL login.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Describe the bug
On MySQL, the engine's "does this table exist?" checks call DatabaseMetaData.getTables(null, null, ...) with no catalog. Connector/J then searches every database the login can see, not just the one in the URL. When one login has rights on more than one OIE database on the same server, the engine finds another database's tables and skips creating or repairing its own. Consistently reproducible.

Two effects:

  • First startup fails. ServerMigrator.initDatabase checks DatabaseUtil.tableExists(connection, "CONFIGURATION"), finds the other database's CONFIGURATION, skips mysql-database.sql, and getCurrentVersion then fails on the missing SCHEMA_INFO. The engine never starts.
  • Per-channel message tables aren't recreated. JdbcDao.checkAndCreateChannelTables lists getTables(null, null, "%", null) across all visible databases, so a missing D_MC<n> counts as present when another database has a table with that name. Messages to that channel then fail with HTTP 500 (Table 'oie_b.D_MC1' doesn't exist).

To Reproduce
One MySQL server, databases oie_a and oie_b, one login shared with ALL PRIVILEGES on both.

  1. Point engine A at jdbc:mysql://host:3306/oie_a with login shared. It starts and creates its schema.
  2. Point engine B at jdbc:mysql://host:3306/oie_b with the same login, and start it. It doesn't start:
    ERROR [Main Server Thread] com.mirth.connect.server.Mirth: Failed to migrate database schema
    com.mirth.connect.model.util.MigrationException: java.sql.SQLSyntaxErrorException: Table 'oie_b.SCHEMA_INFO' doesn't exist
    
    oie_b stays empty.

Controls, same server:

  • Engine C on oie_c with its own login, which sees only oie_c: starts.
  • Engine D on oie_d with the shared login and ?nullDatabaseMeansCurrent=true on the URL: starts.

For the message tables: get B's schema created once (the URL workaround below), then run it with the plain URL. Deploy a channel on A and B (each gets local channel 1, tables D_M1 through D_MSQ1), stop B, drop oie_b.D_MC1 and start B again. B doesn't recreate it, and sending a message to that channel returns HTTP 500. The same steps with C's own login recreate the table.

Expected behavior
Each engine checks for tables in its own database only, and creates or repairs its schema whatever else the login can see.

Actual behavior
The checks match tables in other databases on the same server, so a second OIE database on a shared login never gets its schema, and missing message tables aren't recreated.

Environment

Workaround(s)
Add ?nullDatabaseMeansCurrent=true to the MySQL database.url in mirth.properties, or give each OIE database its own login. Both tested.

Additional context
Only MySQL was tested.

This is very likely Mirth Connect #4440 (open since 2020, never diagnosed): the same SCHEMA_INFO doesn't exist from ServerMigrator.getCurrentVersion on MySQL with the 8.x driver, on a server where the reporter also had another install's schema.

Lingua principale
Java
Stelle
227
Fork
81
Merge medio
3g 15h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenIntegrationEngine/engine

Tutte le issue di OpenIntegrationEngine/engine

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.