Repository navigation
Conversation
iacsha
requested review from
a team,
gibson9583,
jonbartels,
kayyagari,
kpalang,
mgaffigan,
pacmano1 and
ssrowe
November 4, 2026 13:42
mgaffigan
requested changes
Nov 4, 2026
mgaffigan
left a comment
Contributor
There was a problem hiding this comment.
Please add missing DCO.
Also: if this is a mysql specific thing, it should live in the MySQL DAO - not in JdbcDao.
…egrationEngine#489) DatabaseUtil.tableExists and JdbcDao.checkAndCreateChannelTables/tableExists called DatabaseMetaData.getTables with a null catalog, so on MySQL a login with access to other databases matched their tables and a second OIE database was never migrated and missing message tables were not recreated. Pass connection.getCatalog() so each engine only sees its own database; null-catalog behaviour is unchanged on databases where getCatalog() returns null. Signed-off-by: iacsha <122627209+iacsha@users.noreply.github.com>
iacsha
force-pushed
the
fix/489-mysql-catalog-scope
branch
from
November 6, 2026 19:47
dc2c0a6 to
06407c5
Compare
Move the catalog scoping behind a JdbcDao flag that MysqlDaoFactory enables, and limit DatabaseUtil.tableExists scoping to MySQL/MariaDB, so other databases keep the existing null-catalog lookup. Signed-off-by: iacsha <122627209+iacsha@users.noreply.github.com>
Author
|
Thanks @mgaffigan, good call. Moved it so only MySQL changes behaviour (DCO is fixed too). There isn't a MySQL-specific DAO class today, so I followed the existing
Tests: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope table-existence checks to the connection catalog (fixes #489)
Problem
The engine's "does this table exist?" checks call
DatabaseMetaData.getTables(null, null, …)with 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, the engine finds another database's tables and skips creating or
repairing its own:
ServerMigrator.initDatabase→DatabaseUtil.tableExists(conn, "CONFIGURATION")finds the other database'sCONFIGURATION, skipsmysql-database.sql,and
getCurrentVersionthen fails on the missingSCHEMA_INFO.JdbcDao.checkAndCreateChannelTableslists tables across all visible databases, so a missing
D_MC<n>looks present whenanother database has a table of that name; messages then fail with
Table 'oie_b.D_MC1' doesn't exist.Fix
Pass
connection.getCatalog()as the catalog argument at the three sinks:DatabaseUtil.tableExists(both the upper- and lower-case lookups)JdbcDao.checkAndCreateChannelTablesJdbcDao.tableExistsEach engine then only sees tables in its own database. This is portable:
getCatalog()returns the current database, so the lookup is scoped correctly.getCatalog()returnsnull, so behaviour is unchanged (same as today).getCatalog()returns the current database, which is theonly catalog on that connection, so the result is unchanged.
Equivalent to the reporter's
?nullDatabaseMeansCurrent=trueMySQL URL workaround, butapplied in code and database-agnostic.
Tests
Added
DatabaseUtilTest.tableExists_scopesLookupToConnectionCatalog: mocks the connectionand verifies
getTablesis called with the connection's own catalog ("oie_b"), nevernull../gradlew :server:test --tests "*DatabaseUtilTest*"→ 1 test, 0 failures.Notes
The deeper message-table path (
checkAndCreateChannelTables) is fixed the same way but isnot covered by a new unit test here, as it needs a live
JdbcDao/connection; the sharedroot cause and fix are identical across all three sinks.