Details
-
Sub-task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
Currently we use in-memory HSQLDB for Oozie tests. However, if we switch to Derby, we can't run all tests in a single suite because we'll get "Too many open files" error.
The reason is because every testcase creates its own Derby instance and the previous one is not closed properly. A single Derby instance opens around 40-50 files, so the number of open files keeps accumulating.
The following code ensures that Derby is closed after each test:
final String oozieTestDB = System.getProperty("oozie.test.db", "derby"); if (oozieTestDB.equalsIgnoreCase("derby")) { try { String jdbcUrl = "jdbc:derby:" + testCaseDir + "/oozie-derby;shutdown=true"; java.sql.Connection conn = DriverManager.getConnection(jdbcUrl); conn.close(); } catch (Exception e) { // this is expected in case of shutdown log.info("Derby has been shut down"); } }