[ 
https://issues.apache.org/jira/browse/DERBY-6306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13751356#comment-13751356
 ] 

Knut Anders Hatlen commented on DERBY-6306:
-------------------------------------------

Both testSimpleQuery() and testSimpleXplainOnly() execute the following query:

  SELECT country from countries WHERE region = 'Central America'

The former with statistics timing turned on, the latter with timing turned off.

The begin compilation timestamp is recorded in GenericStatement.prepMinion() if 
timing is enabled. However, it is only recorded if the statement is actually 
compiled. Not if it is found in the statement cache.

If testSimpleXplainOnly() runs first, testSimpleQuery() will find the statement 
in the statement cache, and it won't compile it. The begin compilation 
timestamp will therefore be null, and the test fails.

Assuming it is correct to return null if the compilation was short-circuited, 
we could work around the problem by having testSimpleQuery() (or the setUp() 
method) clear the statement cache to ensure the statement is always compiled.

Alternatively, we could make GenericStatement.prepMinion() record non-null 
timestamps and timings in the case where no compilation has happened too.

Any opinions or other suggestions?

I think I'm leaning towards handling this as a test bug and fixing it by 
clearing the statement cache before the test case runs, but I could be 
persuaded otherwise.
                
> XplainStatisticsTest.testSimpleQuery: BEGIN_COMP_TIME unexpectedly NULL
> -----------------------------------------------------------------------
>
>                 Key: DERBY-6306
>                 URL: https://issues.apache.org/jira/browse/DERBY-6306
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.11.0.0
>         Environment: windows_ia32_jdk7
> windows_amd64_jdk8
>            Reporter: Knut Anders Hatlen
>
> Seen on two platforms in nightly testing of trunk revision 1506904:
> http://download.java.net/javadesktop/derby/request_5579443/javadb-task-3691350.html
> http://download.java.net/javadesktop/derby/request_5579443/javadb-task-3691354.html
> junit.framework.AssertionFailedError: BEGIN_COMP_TIME unexpectedly NULL
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest.getNonNullTimestamp(XplainStatisticsTest.java:1538)
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest.verifySensibleStatementTimings(XplainStatisticsTest.java:1417)
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.XplainStatisticsTest.testSimpleQuery(XplainStatisticsTest.java:1038)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:439)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:456)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to