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

Dag H. Wanvik commented on DERBY-5567:
--------------------------------------

Looking at the dependencies being recorded it looks like when the error occur 
in the client suite, the dependencies are registered in a slightly different 
order than when it succeeds for the table/two views in question:

This order seems to always (as traced from 
CreateViewConstantAction#executeConstantAction: dm.addDependency);

TDC_VW_5A_1 depends on t ATDC_5A
ATDC_VW_5A_2 depends on t ATDC_5A
ATDC_VW_5A_2 depends on v ATDC_VW_5A_1

Sometimes however, the depdendencies are registered in this order (no
idea why yet):

ATDC_VW_5A_1 depends on t ATDC_5A
ATDC_VW_5A_2 depends on v ATDC_VW_5A_1
ATDC_VW_5A_2 depends on t ATDC_5A

If this happens for the client of the test, the drop column will give
the seen error. 

A possible theory is that when invalidating from dropping the column
"b", the *direct* dependency "ATDC_VW_5A_2 depends on t ATDC_5A" is
inspected first and the view ATDC_VW_5A_2 is dropped because the action
DROP_COLUMN allows this (CASCADE).

If, however, the invalidation first picks up the *indirect depedency*
transitively (as seems to happen in the stack trace, cf the two levels
of invalidateFor), i.e. it inspects the direct dependency
"ATDC_VW_5A_1 depends on t ATDC_5A" first:

     ATDC_VW_5A_1 depends on t ATDC_5A  -> leads to
     ATDC_VW_5A_2 depends on v ATDC_VW_5A_1

and the last action is DROP_VIEW when one hits the dependent
ATDC_VW_5A_2 (from ATDC_VW_5A_1), cf.
ViewDescripotor#prepareToInvalidate cease "default" which throws an
error as seen.

Presumaby, if the invalidation first inspects "ATDC_VW_5A_2 depends on
t ATDC_5A", the indirect depdency will be removed (since ATDC_VW_5A_2
is now gone) before it is inspected and the action DROP_VIEW is used.


                
> AlterTableTest#testDropColumn fails: drop view cannot be performed due to 
> dependency
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-5567
>                 URL: https://issues.apache.org/jira/browse/DERBY-5567
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.8.2.2
>         Environment: Windows 7 Enterprise SP1, Java 1.7u4 prerelease, -d64
>            Reporter: Dag H. Wanvik
>         Attachments: AlterTableTest.java
>
>
> Saw this when running suitesAll on 10.8.2.2:
> 1) 
> testDropColumn(org.apache.derbyTesting.functionTests.tests.lang.AlterTableTest)java.sql.SQLException:
>  Operation 'DROP VIEW' cannot be performed on object 'ATDC_VW_5A_1' because 
> VIEW 'ATDC_VW_5A_2' is dependent on that object.
>       at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>       at org.apache.derby.client.am.SqlException.getSQLException(Unknown 
> Source)
>       at org.apache.derby.client.am.Statement.executeUpdate(Unknown Source)
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.AlterTableTest.testDropColumn(AlterTableTest.java:2465)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:113)
>       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)
>       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)
>       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)
>       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)
> Caused by: org.apache.derby.client.am.SqlException: Operation 'DROP VIEW' 
> cannot be performed on object 'ATDC_VW_5A_1' because VIEW 'ATDC_VW_5A_2' is 
> dependent on that object.
>       at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
>       at 
> org.apache.derby.client.am.Statement.completeExecuteImmediate(Unknown Source)
>       at 
> org.apache.derby.client.net.NetStatementReply.parseEXCSQLIMMreply(Unknown 
> Source)
>       at 
> org.apache.derby.client.net.NetStatementReply.readExecuteImmediate(Unknown 
> Source)
>       at 
> org.apache.derby.client.net.StatementReply.readExecuteImmediate(Unknown 
> Source)
>       at 
> org.apache.derby.client.net.NetStatement.readExecuteImmediate_(Unknown Source)
>       at org.apache.derby.client.am.Statement.readExecuteImmediate(Unknown 
> Source)
>       at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
>       at org.apache.derby.client.am.Statement.executeUpdateX(Unknown Source)
>       ... 55 more
> Prior to this, though, I saw this on the console, but no error/failure. 
> Probably not related, I believe we have seen this before:
> java.lang.Exception: DRDA_InvalidReplyTooShort.S:Invalid reply from network 
> server: Insufficient data.
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(Unknown
>  Source)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(Unknown
>  Source)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.fillReplyBuffer(Unknown 
> Source)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.readResult(Unknown Source)
>       at 
> org.apache.derby.impl.drda.NetworkServerControlImpl.pingWithNoOpen(Unknown 
> Source)
>       at org.apache.derby.impl.drda.NetworkServerControlImpl.ping(Unknown 
> Source)
>       at org.apache.derby.drda.NetworkServerControl.ping(Unknown Source)
>       at 
> org.apache.derbyTesting.junit.NetworkServerTestSetup.pingForServerUp(NetworkServerTestSetup.java:567)
>       at 
> org.apache.derbyTesting.functionTests.tests.derbynet.ServerPropertiesTest.canPingServer(ServerPropertiesTest.java:280)
>       at 
> org.apache.derbyTesting.functionTests.tests.derbynet.ServerPropertiesTest.ttestSetPortPriority(ServerPropertiesTest.java:472)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:601)
>       at junit.framework.TestCase.runTest(TestCase.java:164)
>       at junit.framework.TestCase.runBare(TestCase.java:130)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:113)
>       at junit.framework.TestResult$1.protect(TestResult.java:106)
>       at junit.framework.TestResult.runProtected(TestResult.java:124)
>       at junit.framework.TestResult.run(TestResult.java:109)
>       at junit.framework.TestCase.run(TestCase.java:120)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.framework.TestResult.runProtected(TestResult.java:124)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       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:21)
>       at junit.framework.TestResult.runProtected(TestResult.java:124)
>       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.framework.TestResult.runProtected(TestResult.java:124)
>       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.framework.TestResult.runProtected(TestResult.java:124)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at junit.framework.TestSuite.runTest(TestSuite.java:230)
>       at junit.framework.TestSuite.run(TestSuite.java:225)
>       at junit.framework.TestSuite.runTest(TestSuite.java:230)
>       at junit.framework.TestSuite.run(TestSuite.java:225)
>       at junit.framework.TestSuite.runTest(TestSuite.java:230)
>       at junit.framework.TestSuite.run(TestSuite.java:225)
>       at junit.framework.TestSuite.runTest(TestSuite.java:230)
>       at junit.framework.TestSuite.run(TestSuite.java:225)
>       at junit.textui.TestRunner.doRun(TestRunner.java:121)
>       at junit.textui.TestRunner.start(TestRunner.java:185)
>       at junit.textui.TestRunner.main(TestRunner.java:143)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to