Scope table and index lookups to the connection catalog on MySQL (fixes #489) #559
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 419 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.361
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #559"
general
weight: 0.35
pacmano1
Scope table and index lookups to the connection catalog on MySQL (fixes #489)
Problem
The engine's "does this table exist?" and "does this index exist?" checks call
DatabaseMetaDatawith a null catalog. On MySQL, 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, an engine finds another database's tables or indexes and skips creating or repairing its own:ServerMigrator.initDatabasecallsDatabaseUtil.tableExists(conn, "CONFIGURATION"), finds the other database'sCONFIGURATION, skipsmysql-database.sql, andgetCurrentVersionthen fails on the missingSCHEMA_INFO.JdbcDao.checkAndCreateChannelTableslists tables across all visible databases, so a missingD_MC<n>looks present when another database has a table of that name. Messages then fail withTable 'oie_b.D_MC1' doesn't exist.DatabaseUtil.indexExistsfinds another database's index of the same name (for exampleD_MM1_INDEX3), so the "Add Metadata Index" database task never appears.Fix
Only MySQL (and MariaDB) changes behaviour. Every other database keeps the existing null-catalog lookup.
DatabaseUtil). A newlookupCatalogreturnsconnection.getCatalog()when the database product is MySQL or MariaDB, andnullotherwise.tableExistsandindexExistsboth use it, for their upper- and lower-case lookups.JdbcDao). There is no MySQL-specific DAO class, so this follows the existingsetQuoteCharpattern.JdbcDaogetssetScopeTablesToCatalog(boolean), off by default, whichMysqlDaoFactoryturns on.checkAndCreateChannelTablesandtableExistspass the catalog only when it is enabled.This has the same effect as the reporter's
?nullDatabaseMeansCurrent=trueURL workaround, applied in code.Tests
DatabaseUtilTest(4 tests):- On MySQL,
tableExistsandindexExistspass the connection's catalog ("oie_b").- On PostgreSQL, both keep a
nullcatalog and never callgetCatalog().- The MySQL
indexExiststest fails without the latest commit.JdbcDaoTest:-
testTableLookupUnscopedByDefault-
testTableLookupScopedToCatalogWhenEnabledgradle :server:test --tests "DatabaseUtilTest": 4 tests, 0 failures.End-to-end on MySQL 8.4 with Connector/J 8.4.0, two engines on one login: @pacmano1 confirmed in review that the startup and message-table cases are fixed and that engine D with
?nullDatabaseMeansCurrent=truestill works.Release Note
MySQL/MariaDB: table and index checks now stay in the configured database (https://github.com/OpenIntegrationEngine/engine/issues/489)
When one database login could see more than one OIE database on the same server, the engine could find another database's tables or indexes and skip creating its own. That caused a failed first startup, missing D_MC<n> message tables, and a missing "Add Metadata Index" task. Lookups are now scoped to the database named in the connection URL. Other database types are unchanged. If you added ?nullDatabaseMeansCurrent=true to your MySQL URL as a workaround, you no longer need it, and leaving it in is harmless.