Skip to content

Commit f1c1d16

Browse files
shba24Isaac
andcommitted
[Server] Explain the isolation-level test and the MySQL template's halt_on_error
The isolation test asks for a level other than the default, because asking for the default would pass even if nothing were restored. The MySQL template keeps halt_on_error off only for the one index InnoDB rejects; a TODO removes it once the schema migration steps build the template. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
1 parent 459d8aa commit f1c1d16

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎server/src/test/java/io/unitycatalog/server/persist/utils/TransactionManagerTest.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ public static void setUp() {
297297
realSessionFactory = testDatabase.sessionFactory();
298298
}
299299

300+
/**
301+
* A transaction runs at the isolation level its caller asks for, and the pooled connection goes
302+
* back to its default afterwards, so the level never leaks into the next transaction. The test
303+
* asks for a level other than the database's default: asking for the default would pass even if
304+
* nothing were restored.
305+
*/
300306
@Test
301307
public void testIsolationLevelIsSetAndRestored() {
302308
final int[] isolationDuringTx = new int[1];

‎server/src/test/java/io/unitycatalog/server/testdatabase/MySqlDatabases.java‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ void createDatabase(String name) {
7979

8080
@Override
8181
void configureTemplate(Properties hibernateProperties) {
82-
// MySQL rejects the index on uc_staging_tables.staging_location (key too long); carry on
83-
// without it, as a real MySQL install does.
82+
// Hibernate's DDL always includes one index MySQL rejects: staging_location is 2048
83+
// characters, 8192 bytes in utf8mb4, over InnoDB's 3072-byte key limit. With halt_on_error the
84+
// template build would fail on every run, so carry on without that index, as a real MySQL
85+
// install does. templateBuilt then checks that every table was created.
86+
// TODO: remove once the template is built by the schema migration steps, which leave this
87+
// index out and stop on any error.
8488
hibernateProperties.setProperty("hibernate.hbm2ddl.halt_on_error", "false");
8589
}
8690

0 commit comments

Comments
 (0)