Conversation
…ng MySQL database and Oracle schema Pin each layer that keeps a table or index of another database of the server from answering for one of this backend's in openTree(): - JDBCStorageRetryTest: the MySQL guards pass the database of the connection as the catalog; covers() drops a row of another database; under databaseTerm=SCHEMA the schema path alone tells the neighbour apart. - MySqlTestCase: a live case over a second database of the same server, under the default databaseTerm and under databaseTerm=SCHEMA. - OracleTestCase: a live case over another user's schema, visible to the suite through a grant. - TestCase: drop such a neighbour left by a killed run before dropStaleTrees(), which would otherwise skip the whole class on every later run. Fixes OpenIdentityPlatform#1075
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.
Fixes #1075
Test-only change: the MySQL/Oracle twin of #902's postgres case (
PgSqlTestCase.testAnOpenIsAnsweredForByNoTableOfASchemaOffTheSearchPath), shaped by what the drivers actually return rather than by the case the issue sketched.What the drivers do (measured)
Probes against the drivers this backend ships (Connector/J 9.2.0 on mysql:9.2, ojdbc8 23.7 on oracle-free 23.26.2), with a neighbour holding the same table and index name:
getCatalog/getSchemadatabaseTerm=CATALOGnullTABLE_CAT=<neighbour>rows withnullgetTables/getIndexInfo, andisSameCataloginTableScope.covers()databaseTerm=SCHEMAnull/ databaseTABLE_CAT=def,TABLE_SCHEM=<neighbour>schemaPathOf()+ the schema half ofcovers()null/OPENDJSCHEM=<neighbour>oncegrant selectis givenschemaPathOf()+ the schema half ofcovers()So the case #1075 sketched — two databases on the default MySQL connection — goes red only when both layers give way at once; a loosening of either one alone, which is what the issue worries about, stays green there. Each layer needs a case of its own.
Changes
JDBCStorageRetryTest— three mock cases on the mysql branch:testTheMySqlGuardsAskInTheDatabaseOfTheConnection—getTables/getIndexInfoare asked withcon.getCatalog(), notany();testAnIndexOfAnotherDatabaseAnswersForNoneOfThisOne— an index row of anotherTABLE_CATis not this backend's, andcreate indexis issued;testUnderDatabaseTermSchemaAnIndexOfAnotherDatabaseAnswersForNoneOfThisOne— the same with the row shape measured underdatabaseTerm=SCHEMA.MySqlTestCase.testAnOpenIsAnsweredForByNoTableOfAnotherDatabase— live, data-provided overcatalog(default) andschema(?databaseTerm=SCHEMA); neighbour database made asroot, asserted throughinformation_schema.OracleTestCase.testAnOpenIsAnsweredForByNoTableOfAnotherSchema— live; the neighbour user is made bySYSTEM(the container'sORACLE_PASSWORDis thewithPasswordvalue — checked in testcontainers 1.20.6) and granted toopendj, without which the dictionary views show nothing and the case would pin nothing. The manualdocker runhint now passes-e ORACLE_PASSWORD=password.TestCase.dropStaleNeighbours()— a best-effort hook run insetUp()beforedropStaleTrees(). That listing spans every database/schema the connection sees, so a neighbour left by a killed run on a long-lived manual container would make its unqualified (mysql) or unprivileged (oracle)drop tablefail and skip the whole class on every later run.No production code changes.
Verification
Mutants of
JDBCStorage, each run against the mock class and the live case:getTables/getIndexInfo…AskInTheDatabase…covers()ignores the row's database…AnIndexOfAnotherDatabase…catalog)schemaPathOf()returnsnull…UnderDatabaseTermSchema…schema)schemaPathOf()returnsnullORA-00942)Head, one JVM per class:
JDBCStorageRetryTest116/116,MySqlTestCase97/97,PgSqlTestCase94/94, jdbcEncryptedTestCase38/38,OracleTestCase92 passed + 1 skip (the existingSkipExceptionoftestAConnectionGetsItsLockBoundBackAfterADdlon Oracle — "no session lock bound").MsSqlTestCaseis not runnable locally and is left to CI.