Derby
  1. Derby
  2. DERBY-5437

Load all toursdb tables in one invocation of ij

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.9.1.0
    • Component/s: Demos/Scripts
    • Labels:
      None

      Description

      The toursdb example database is built as part of "ant all". Currently, java/demo/toursdb/build.xml invokes ij nine times, as well as a custom Java program (toursdb.insertMaps) once, to create the database, and all of these run in separate Java processes. This means the database engine is cold booted 10 times, which can take considerable time.

      There is already a script called loadTables.sql, which calls loadCOUNTRIES.sql, loadCITIES.sql, loadAIRLINES.sql, loadFLIGHTS1.sql, loadFLIGHTS2.sql, loadFLIGHTAVAILABILITY1.sql and loadFLIGHTAVAILABILITY2.sql. I propose that we use that script instead of invoking each of the sub-scripts separately. This would reduce the number of times the database engine would have to be booted from 10 to 4 per full build.

      1. d5437.diff
        1 kB
        Knut Anders Hatlen
      2. d5437-2.diff
        6 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Attaching a patch that loads all the tables in one invocation of ij. This reduces the time it takes to run "ant all" in my environment by 30 seconds (from 1 min 40 sec to 1 min 10 sec).

        Show
        Knut Anders Hatlen added a comment - Attaching a patch that loads all the tables in one invocation of ij. This reduces the time it takes to run "ant all" in my environment by 30 seconds (from 1 min 40 sec to 1 min 10 sec).
        Hide
        Knut Anders Hatlen added a comment -

        Oops... The patch doesn't actually load the tables. Looking at the log in generated/toursdb/toursdb.out, I see messages like this:

        run 'loadCOUNTRIES.sql';
        IJ ERROR: File not found
        ij> run 'loadCITIES.sql';
        IJ ERROR: File not found
        ij> run 'loadAIRLINES.sql';
        IJ ERROR: File not found
        ij> run 'loadFLIGHTS1.sql';
        IJ ERROR: File not found
        ij> run 'loadFLIGHTS2.sql';
        IJ ERROR: File not found
        ij> run 'loadFLIGHTAVAILABILITY1.sql';
        IJ ERROR: File not found
        ij> run 'loadFLIGHTAVAILABILITY2.sql';
        IJ ERROR: File not found

        Probably because the working directory of the ij process isn't the directory in which the sql files live.

        While looking at the toursdb log, I also noticed an error that's also seen on a clean trunk, where the toursdb.insertMaps program doesn't find the database. Filed DERBY-5438 to track that problem.

        Show
        Knut Anders Hatlen added a comment - Oops... The patch doesn't actually load the tables. Looking at the log in generated/toursdb/toursdb.out, I see messages like this: run 'loadCOUNTRIES.sql'; IJ ERROR: File not found ij> run 'loadCITIES.sql'; IJ ERROR: File not found ij> run 'loadAIRLINES.sql'; IJ ERROR: File not found ij> run 'loadFLIGHTS1.sql'; IJ ERROR: File not found ij> run 'loadFLIGHTS2.sql'; IJ ERROR: File not found ij> run 'loadFLIGHTAVAILABILITY1.sql'; IJ ERROR: File not found ij> run 'loadFLIGHTAVAILABILITY2.sql'; IJ ERROR: File not found Probably because the working directory of the ij process isn't the directory in which the sql files live. While looking at the toursdb log, I also noticed an error that's also seen on a clean trunk, where the toursdb.insertMaps program doesn't find the database. Filed DERBY-5438 to track that problem.
        Hide
        Knut Anders Hatlen added a comment -

        Attaching version 2 of the patch, which makes ij run with java/demo/toursdb as working directory (so that it finds the scripts invoked indirectly by loadTables.sql), and sets derby.system.home to make sure the database and derby.log ends up in the generated/toursdb directory.

        The patch also changes the toursdb.insertMaps class so that its main() method shuts down the database cleanly before exiting. This removes the need for a new invocation of ij just to perform recovery and shut down the database after on, so the disconnect.sql script could be removed from the source tree.

        The patch reduces the number of ij invocations from 9 to 1. Now that toursdb is actually built, it takes a little longer than with the previous patch, but I still see a 25 second speedup of "ant all" compared to a clean trunk.

        Show
        Knut Anders Hatlen added a comment - Attaching version 2 of the patch, which makes ij run with java/demo/toursdb as working directory (so that it finds the scripts invoked indirectly by loadTables.sql), and sets derby.system.home to make sure the database and derby.log ends up in the generated/toursdb directory. The patch also changes the toursdb.insertMaps class so that its main() method shuts down the database cleanly before exiting. This removes the need for a new invocation of ij just to perform recovery and shut down the database after on, so the disconnect.sql script could be removed from the source tree. The patch reduces the number of ij invocations from 9 to 1. Now that toursdb is actually built, it takes a little longer than with the previous patch, but I still see a 25 second speedup of "ant all" compared to a clean trunk.
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1179786.

        Show
        Knut Anders Hatlen added a comment - Committed revision 1179786.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development