[BUG] On MySQL, table checks see other databases on the same login, so a second OIE database never gets its schema
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
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
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.initDatabasechecksDatabaseUtil.tableExists(connection, "CONFIGURATION"), finds the other database'sCONFIGURATION, skipsmysql-database.sql, andgetCurrentVersionthen fails on the missingSCHEMA_INFO. The engine never starts. - Per-channel message tables aren't recreated.
JdbcDao.checkAndCreateChannelTableslistsgetTables(null, null, "%", null)across all visible databases, so a missingD_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.
- Point engine A at
jdbc:mysql://host:3306/oie_awith loginshared. It starts and creates its schema. - Point engine B at
jdbc:mysql://host:3306/oie_bwith 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 existoie_bstays empty.
Controls, same server:
- Engine C on
oie_cwith its own login, which sees onlyoie_c: starts. - Engine D on
oie_dwith the shared login and?nullDatabaseMeansCurrent=trueon 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
- OS: Linux (Ubuntu 22.04)
- Java: Zulu 17.0.17
- OIE 4.6.0,
mysql-connector-j-8.4.0.jaras bundled; MySQL 8.4 - The code is unchanged on main (a750221ba2eab8be66dcd1bbfa56c70cca025923):
DatabaseUtil.tableExists, used byServerMigrator.initDatabase(line 260) and some migrations and database tasksJdbcDao.checkAndCreateChannelTablesandJdbcDao.tableExists
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
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenIntegrationEngine/engine
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenIntegrationEngine/engine#496 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenIntegrationEngine/engine#485 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
OpenIntegrationEngine/engine#478 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenIntegrationEngine/engine#355 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
OpenIntegrationEngine/engine#347 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenIntegrationEngine/engine
Issue simili
-
False Negative: InnerTypeLastCheck does not report members declared after inner enums or annotationsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
checkstyle/checkstyle#22027 ·
I maintainer di solito rispondono entro 1 giorno
-
bug follow-up lane:auto
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
Sanne/incus-spawn#1497 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG][RUST] chrono date-time path/query/header params are not serialized as RFC 3339Forse già presa @teovillanueva l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OpenAPITools/openapi-generator#25297 ·
I maintainer di solito rispondono entro 1 giorno
-
[CI] NettyClientTest.testServerDisconnection may fail with DisconnectExceptionForse già presa @yangshangqing95 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno