Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-3111 [Umbrella] Fix flaky tests in Oozie
  3. OOZIE-3296

Make sure that Derby is shut down after each testcase

    XMLWordPrintableJSON

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");
                  }
              }
      

      Attachments

        Activity

          People

            pbacsko Peter Bacsko
            pbacsko Peter Bacsko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: