Details

    • Urgency:
      Normal
    • Issue & fix info:
      Known fix, Newcomer

      Description

      place holder for converting subquery.sql to junit , which gives intermittent failures with derbyall

      1. DERBY-3808_2.diff
        204 kB
        Myrna van Lunteren
      2. DERBY-3808_1.stat
        205 kB
        Myrna van Lunteren
      3. DERBY-3808_1.diff
        205 kB
        Myrna van Lunteren
      4. DERBY_3808_stat_07_10.txt
        0.5 kB
        Manjula Kutty
      5. DERBY_3808_diff_07_10.txt
        196 kB
        Manjula Kutty

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        [bulk update: close all resolved issues that haven't had any activity the last year]

        Show
        Knut Anders Hatlen added a comment - [bulk update: close all resolved issues that haven't had any activity the last year]
        Hide
        Myrna van Lunteren added a comment -

        committed the patch without dependency check with revision 1242409, and made two further minor cleanup check-ins with revision 1242413 and 1242460. Backported to 10.8 with revision 1242612.

        Show
        Myrna van Lunteren added a comment - committed the patch without dependency check with revision 1242409, and made two further minor cleanup check-ins with revision 1242413 and 1242460. Backported to 10.8 with revision 1242612.
        Hide
        Dag H. Wanvik added a comment - - edited

        Thanks for checking, Myrna. I'm OK with your solution. However, most tests should clean up as much as possible, I think. At least if that is faster than creating and deleting single use databases, and I think it is? Regression test running time is always a challenge.. Good you documented those tests leaving deps behind.

        Show
        Dag H. Wanvik added a comment - - edited Thanks for checking, Myrna. I'm OK with your solution. However, most tests should clean up as much as possible, I think. At least if that is faster than creating and deleting single use databases, and I think it is? Regression test running time is always a challenge.. Good you documented those tests leaving deps behind.
        Hide
        Myrna van Lunteren added a comment -

        I'm attaching a second version of the patch.
        In this, I've removed the checks for the dependencies.

        I checked laboriously through lang._Suite.java and identified the following tests to leave behind dependencies (i.e. make the dependencies in the previous patch's SubqueryTest fail):

        • CreateTableFromQueryTest
        • ForBitDataTest
        • CollationTest2
        • TableFunctionTest
        • SynonymTest
        • ViewsTest
          I tried to eliminate dependencies from CreateTableFromQueryTest, but was unsuccessful...

        And thinking about it, the purpose of the SubqueryTest is not to check for added dependencies. So, instead of spending more time on this, I decided to eliminate the checks.

        If a test intends to check for dependencies it should probably create its own singleuse database.

        Full suites.All tests ran cleanly for me on Linux with ibm 1.6. I intend to commit soon and probably backport to 10.8.

        Show
        Myrna van Lunteren added a comment - I'm attaching a second version of the patch. In this, I've removed the checks for the dependencies. I checked laboriously through lang._Suite.java and identified the following tests to leave behind dependencies (i.e. make the dependencies in the previous patch's SubqueryTest fail): CreateTableFromQueryTest ForBitDataTest CollationTest2 TableFunctionTest SynonymTest ViewsTest I tried to eliminate dependencies from CreateTableFromQueryTest, but was unsuccessful... And thinking about it, the purpose of the SubqueryTest is not to check for added dependencies. So, instead of spending more time on this, I decided to eliminate the checks. If a test intends to check for dependencies it should probably create its own singleuse database. Full suites.All tests ran cleanly for me on Linux with ibm 1.6. I intend to commit soon and probably backport to 10.8.
        Hide
        Dag H. Wanvik added a comment -

        > However, I have one concern before this is ready for commit: when
        > running the test by itself, it passes, but when running it in the
        > lang._Suite, the dependencies are different in 3 fixtures, suggesting
        > some other test is leaving stuff behind.

        It would probably be good to figure out where these come from..

        Show
        Dag H. Wanvik added a comment - > However, I have one concern before this is ready for commit: when > running the test by itself, it passes, but when running it in the > lang._Suite, the dependencies are different in 3 fixtures, suggesting > some other test is leaving stuff behind. It would probably be good to figure out where these come from..
        Hide
        Dag H. Wanvik added a comment -

        > Another issue I ran into with assertSequence, is that one of the table
        > names has an '_'. The method converts underscores to tabs, presumably
        > attempting to make the strings in the tests more manageable.

        Yes, I found it hard to handle otherwise

        > I adjusted the assertSequence method to only replace _ for tabs in
        > the first 15 characters, assuming that we'd not go further than 15
        > levels...

        Probably fine. You could also only convert leading underscores, since
        I think that's the only place where the translation is needed/expected
        if I remember correctly. Sorry for the fragile code

        Show
        Dag H. Wanvik added a comment - > Another issue I ran into with assertSequence, is that one of the table > names has an '_'. The method converts underscores to tabs, presumably > attempting to make the strings in the tests more manageable. Yes, I found it hard to handle otherwise > I adjusted the assertSequence method to only replace _ for tabs in > the first 15 characters, assuming that we'd not go further than 15 > levels... Probably fine. You could also only convert leading underscores, since I think that's the only place where the translation is needed/expected if I remember correctly. Sorry for the fragile code
        Hide
        Myrna van Lunteren added a comment -

        Attaching a patch based on Manjula's work, ready for review.

        I modified the test from Manjula's in the following ways:

        • re-applied the changes made to subquery.sql (and .out) in the last 3 1/2 years
        • reformatted Manjula's patch, mostly removing blank lines so the specific test steps were grouped by select statement.
        • corrected one instance where autocommit was set incorrectly, resulting in fixture testSubqueryFlattning failing if all fixtures ran.
        • implemented the following of Kathey's suggestions:
        • added the License header
        • set the derby.language.statementCacheSize=0 by wrapping in a SystemPropertyTestSetup.
        • used CleanDatabaseTestSetup/decorate.sql to create the initial set of tables
        • used setAutoCommit() and rollback()

        I did not implement a 'usesJoinOrder' method, because I found there already were methods in RuntimeStatisticsParser that allowed to check for the desired plan details.
        I used assertSequence.
        Unfortunately, that did not work in one particular instance, where if I printed out the rtsp.toString, it looked on my computer as if there text on top of a tab. I have no idea how that could be achieved, but after that, the assertSequence method found no further matches. Instead of spending more time puzzling about this problem at this time, I checked the rest of the strings using another RuntimeStatisticsParser method, findStrings.

        Another issue I ran into with assertSequence, is that one of the table names has an '_'. The method converts underscores to tabs, presumably attempting to make the strings in the tests more manageable. But in this case, it converted the name 'T_1' and 'T_3' to 'T\t1' and 'T\t3' and then looked for those strings, and of course couldn't find them.
        I adjusted the assertSequence method to only replace _ for tabs in the first 15 characters, assuming that we'd not go further than 15 levels...

        I did test this in all the tests where the method was directly or indirectly called, and they all passed.

        I also ran this test on iseries - where it always failed in the master-based form - and it passed there too.

        However, I have one concern before this is ready for commit: when running the test by itself, it passes, but when running it in the lang._Suite, the dependencies are different in 3 fixtures, suggesting some other test is leaving stuff behind.

        Any suggestions??

        These are the failures when run in the lang suite:
        1) testExpressionNonCorrelated(org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest)junit.framework.AssertionFailedError: Column value mismatch @ column '1', row 1:
        Expected: >No open scans, etc.
        16 dependencies found<
        Found: >No open scans, etc.
        37 dependencies found<
        at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1215)
        at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1127)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1014)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:937)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:894)
        at org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest.testExpressionNonCorrelated(SubqueryTest.java:316)
        ...
        2) testDistinct(org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest)junit.framework.AssertionFailedError: Column value mismatch @ column '1', row 1:
        Expected: >No open scans, etc.
        16 dependencies found<
        Found: >No open scans, etc.
        37 dependencies found<
        at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1215)
        at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1127)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1014)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:937)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:894)
        at org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest.testDistinct(SubqueryTest.java:1005)
        ...
        3) testErrorsInNestedSubqueries(org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest)junit.framework.AssertionFailedError: Column value mismatch @ column '1', row 1:
        Expected: >No open scans, etc.
        16 dependencies found<
        Found: >No open scans, etc.
        37 dependencies found<
        at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1215)
        at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1127)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1014)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:937)
        at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:894)
        at org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest.testErrorsInNestedSubqueries(SubqueryTest.java:1622)

        Show
        Myrna van Lunteren added a comment - Attaching a patch based on Manjula's work, ready for review. I modified the test from Manjula's in the following ways: re-applied the changes made to subquery.sql (and .out) in the last 3 1/2 years reformatted Manjula's patch, mostly removing blank lines so the specific test steps were grouped by select statement. corrected one instance where autocommit was set incorrectly, resulting in fixture testSubqueryFlattning failing if all fixtures ran. implemented the following of Kathey's suggestions: added the License header set the derby.language.statementCacheSize=0 by wrapping in a SystemPropertyTestSetup. used CleanDatabaseTestSetup/decorate.sql to create the initial set of tables used setAutoCommit() and rollback() I did not implement a 'usesJoinOrder' method, because I found there already were methods in RuntimeStatisticsParser that allowed to check for the desired plan details. I used assertSequence. Unfortunately, that did not work in one particular instance, where if I printed out the rtsp.toString, it looked on my computer as if there text on top of a tab. I have no idea how that could be achieved, but after that, the assertSequence method found no further matches. Instead of spending more time puzzling about this problem at this time, I checked the rest of the strings using another RuntimeStatisticsParser method, findStrings. Another issue I ran into with assertSequence, is that one of the table names has an '_'. The method converts underscores to tabs, presumably attempting to make the strings in the tests more manageable. But in this case, it converted the name 'T_1' and 'T_3' to 'T\t1' and 'T\t3' and then looked for those strings, and of course couldn't find them. I adjusted the assertSequence method to only replace _ for tabs in the first 15 characters, assuming that we'd not go further than 15 levels... I did test this in all the tests where the method was directly or indirectly called, and they all passed. I also ran this test on iseries - where it always failed in the master-based form - and it passed there too. However, I have one concern before this is ready for commit: when running the test by itself, it passes, but when running it in the lang._Suite, the dependencies are different in 3 fixtures, suggesting some other test is leaving stuff behind. Any suggestions?? These are the failures when run in the lang suite: 1) testExpressionNonCorrelated(org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest)junit.framework.AssertionFailedError: Column value mismatch @ column '1', row 1: Expected: >No open scans, etc. 16 dependencies found< Found: >No open scans, etc. 37 dependencies found< at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1215) at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1127) at org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1014) at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:937) at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:894) at org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest.testExpressionNonCorrelated(SubqueryTest.java:316) ... 2) testDistinct(org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest)junit.framework.AssertionFailedError: Column value mismatch @ column '1', row 1: Expected: >No open scans, etc. 16 dependencies found< Found: >No open scans, etc. 37 dependencies found< at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1215) at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1127) at org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1014) at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:937) at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:894) at org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest.testDistinct(SubqueryTest.java:1005) ... 3) testErrorsInNestedSubqueries(org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest)junit.framework.AssertionFailedError: Column value mismatch @ column '1', row 1: Expected: >No open scans, etc. 16 dependencies found< Found: >No open scans, etc. 37 dependencies found< at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1215) at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1127) at org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1014) at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:937) at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:894) at org.apache.derbyTesting.functionTests.tests.lang.SubqueryTest.testErrorsInNestedSubqueries(SubqueryTest.java:1622)
        Hide
        Myrna van Lunteren added a comment -

        I think Manjula did most of this work already and Kathey gave pseudo-code for the remaining adjustments, so I marked it Newcomer, and known fix although it's more of an almost known fix.

        Show
        Myrna van Lunteren added a comment - I think Manjula did most of this work already and Kathey gave pseudo-code for the remaining adjustments, so I marked it Newcomer, and known fix although it's more of an almost known fix.
        Hide
        Manjula Kutty added a comment -

        Thank you for the comments Kathey. I will look into them and also will try to implement the RuntimeStatisticsParser and will upload a new patch.

        Show
        Manjula Kutty added a comment - Thank you for the comments Kathey. I will look into them and also will try to implement the RuntimeStatisticsParser and will upload a new patch.
        Hide
        Kathey Marsden added a comment -

        Thanks Manjula for the patch. Just a few comments.

        • Need the license header
        • The original test set derby.language.statementCacheSize=0 so we should do that with SystemPropertyTestSetup.
        • It would be better to use CleanDatabaseTestSetup/decorateSql for the initial creation of tables and functions so that it doesn't occur with each fixture.
        • You can use setAutocommit() and rollback() instead of getConnection().setAutocommit() and getConnection().rollback().

        For the new method for RuntimeStatisticsParser, I think something like this should work. (Needs testing and javadoc).

        public boolean findOrderedStrings(String[] searchStrings)

        { return findOrderedStrings(0,searchStrings); }

        private boolean findOrderedStrings(int start, String[] searchStrings) {
        int len = searchStrings.length;
        if (searchStrings.length == 0)
        return true;
        else

        { int offset = statistics.indexOf(searchStrings[0],start); if (offset == -1) return false; String[] newSearchStrings = new String[len -1]; System.arraycopy(searchStrings, 1, newSearchStrings, 0, len-1); return findOrderedStrings(offset, newSearchStrings); }

        }

        Show
        Kathey Marsden added a comment - Thanks Manjula for the patch. Just a few comments. Need the license header The original test set derby.language.statementCacheSize=0 so we should do that with SystemPropertyTestSetup. It would be better to use CleanDatabaseTestSetup/decorateSql for the initial creation of tables and functions so that it doesn't occur with each fixture. You can use setAutocommit() and rollback() instead of getConnection().setAutocommit() and getConnection().rollback(). For the new method for RuntimeStatisticsParser, I think something like this should work. (Needs testing and javadoc). public boolean findOrderedStrings(String[] searchStrings) { return findOrderedStrings(0,searchStrings); } private boolean findOrderedStrings(int start, String[] searchStrings) { int len = searchStrings.length; if (searchStrings.length == 0) return true; else { int offset = statistics.indexOf(searchStrings[0],start); if (offset == -1) return false; String[] newSearchStrings = new String[len -1]; System.arraycopy(searchStrings, 1, newSearchStrings, 0, len-1); return findOrderedStrings(offset, newSearchStrings); } }
        Hide
        Manjula Kutty added a comment -

        Attaching the patch for SubqueryTest.java. This is is the junit conversion of subquery.sql. I didn't include 2 test cases which has Runtimestatistics to check the join order. Me with the help of Kathey Marsden will implement a method for the same in runtimestatistics parser and will include those 2 tests cases later. Please review this patch and if looks good please commit.

        Show
        Manjula Kutty added a comment - Attaching the patch for SubqueryTest.java. This is is the junit conversion of subquery.sql. I didn't include 2 test cases which has Runtimestatistics to check the join order. Me with the help of Kathey Marsden will implement a method for the same in runtimestatistics parser and will include those 2 tests cases later. Please review this patch and if looks good please commit.

          People

          • Assignee:
            Myrna van Lunteren
            Reporter:
            Manjula Kutty
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development