You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2011/03/11 15:57:01 UTC

[jira] Updated: (DERBY-5045) Assert failures in UpdateStatisticsTest

     [ https://issues.apache.org/jira/browse/DERBY-5045?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-5045:
--------------------------------------

    Attachment: derby-5045-1a.diff

I believe that the attached patch fixes the problem. Since the istat thread doesn't take any read locks, not even intention locks on the table, the index may be dropped by someone else until we start writing the stats to SYSSTATISTICS. Once we start writing to SYSSTATISTICS, the istat thread will have exclusive locks that prevent the table and its indexes from being dropped.

The patch checks if the index still exists after it has written the new statistics to SYSSTATISTICS, but before it has committed the transaction. If the index doesn't exist, it aborts the transaction instead of committing it. When I run the DERBY-5124 experiment with this patch, the orphaned rows don't turn up in SYSSTATISTICS.

> Assert failures in UpdateStatisticsTest
> ---------------------------------------
>
>                 Key: DERBY-5045
>                 URL: https://issues.apache.org/jira/browse/DERBY-5045
>             Project: Derby
>          Issue Type: Bug
>          Components: Services, Test
>    Affects Versions: 10.8.0.0
>            Reporter: Knut Anders Hatlen
>              Labels: derby_triage10_8
>         Attachments: derby-5045-1a.diff
>
>
> I saw these failures when running suites.All against revision 1070949 + the 1b patch attached to DERBY-642:
> junit.framework.AssertionFailedError: Index statistics for <ALL TABLES>
> 1: {tableId=94a458d3-012e-2a1f-d23d-ffff93077fa3, tableName=<n/a>, indexName=<n/a>, lcols=1, rows=160, unique/card=160, created=2011-02-15 17:31:00.951}
>  expected:<0> but was:<1>
> 	at org.apache.derbyTesting.junit.IndexStatsUtil.assertStats(IndexStatsUtil.java:132)
> 	at org.apache.derbyTesting.junit.IndexStatsUtil.assertNoStats(IndexStatsUtil.java:109)
> 	at org.apache.derbyTesting.functionTests.tests.lang.UpdateStatisticsTest.testUpdateStatistics(UpdateStatisticsTest.java:91)
> 	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
> 	at junit.extensions.TestSetup.run(TestSetup.java:27)
> 	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
> 	at junit.extensions.TestSetup.run(TestSetup.java:27)
> 	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> junit.framework.AssertionFailedError: Index statistics for <ALL TABLES>
> 1: {tableId=94a458d3-012e-2a1f-d23d-ffff93077fa3, tableName=<n/a>, indexName=<n/a>, lcols=1, rows=160, unique/card=160, created=2011-02-15 17:31:00.951}
>  expected:<0> but was:<1>
> 	at org.apache.derbyTesting.junit.IndexStatsUtil.assertStats(IndexStatsUtil.java:132)
> 	at org.apache.derbyTesting.junit.IndexStatsUtil.assertNoStats(IndexStatsUtil.java:109)
> 	at org.apache.derbyTesting.functionTests.tests.lang.UpdateStatisticsTest.testUpdateStatistics(UpdateStatisticsTest.java:91)
> 	at org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:112)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
> 	at junit.extensions.TestSetup.run(TestSetup.java:27)
> 	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
> 	at junit.extensions.TestSetup.run(TestSetup.java:27)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
> 	at junit.extensions.TestSetup.run(TestSetup.java:27)
> 	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> 	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
> 	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
> 	at junit.extensions.TestSetup.run(TestSetup.java:27)
> 	at org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira