[
https://issues.apache.org/jira/browse/DERBY-5406?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Knut Anders Hatlen updated DERBY-5406:
--------------------------------------
Attachment: d5406-1a-detect-invalidation-during-compilation.diff
The attached patch (d5406-1a-detect-invalidation-during-compilation.diff)
improves the invalidation-during-compilation.diff patch attached to DERBY-4275
by restoring the state of the context stack before retrying the compilation.
This prevents the "Cannot issue commit in a nested connection" errors seen with
the original patch.
Although the patch makes the failures happen less frequently, there still
appears to be race conditions in this area. I've seen the following two
failures when running the D4275.java repro attached to DERBY-4275:
1) java.sql.SQLException: The conglomerate (1,136) requested does not exist.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:98)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:256)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:400)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:348)
at
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2290)
at
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:82)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:150)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.java:82)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(EmbedPreparedStatement30.java:63)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(EmbedPreparedStatement40.java:40)
at
org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Driver40.java:107)
at
org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:1615)
at
org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:1443)
at D4275$1.run0(D4275.java:32)
at D4275$1.run(D4275.java:23)
Caused by: java.sql.SQLException: The conglomerate (1,136) requested does not
exist.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
... 14 more
Caused by: ERROR XSAI2: The conglomerate (1,136) requested does not exist.
at
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:278)
at
org.apache.derby.impl.store.access.heap.HeapConglomerateFactory.readConglomerate(HeapConglomerateFactory.java:254)
at
org.apache.derby.impl.store.access.RAMAccessManager.conglomCacheFind(RAMAccessManager.java:482)
at
org.apache.derby.impl.store.access.RAMTransaction.findExistingConglomerate(RAMTransaction.java:394)
at
org.apache.derby.impl.store.access.RAMTransaction.getStaticCompiledConglomInfo(RAMTransaction.java:665)
at
org.apache.derby.impl.sql.compile.BaseJoinStrategy.fillInScanArgs1(BaseJoinStrategy.java:100)
at
org.apache.derby.impl.sql.compile.NestedLoopJoinStrategy.getScanArgs(NestedLoopJoinStrategy.java:252)
at
org.apache.derby.impl.sql.compile.FromBaseTable.getScanArguments(FromBaseTable.java:3496)
at
org.apache.derby.impl.sql.compile.FromBaseTable.generateResultSet(FromBaseTable.java:3186)
at
org.apache.derby.impl.sql.compile.FromBaseTable.generate(FromBaseTable.java:3113)
at
org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(ProjectRestrictNode.java:1382)
at
org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(ProjectRestrictNode.java:1334)
at
org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(ProjectRestrictNode.java:1382)
at
org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(ProjectRestrictNode.java:1334)
at
org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(ScrollInsensitiveResultSetNode.java:109)
at
org.apache.derby.impl.sql.compile.CursorNode.generate(CursorNode.java:637)
at
org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:345)
at
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:472)
at
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:93)
at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:1103)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:131)
... 8 more
Test stopped after 2927 ms
This error happens in a different code path, outside of the current retry logic.
2) java.sql.SQLException: The conglomerate (136,832) requested does not exist.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:98)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:256)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:400)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:348)
at
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2290)
at
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:82)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1334)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1686)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(EmbedPreparedStatement.java:284)
at D4275$1.run0(D4275.java:35)
at D4275$1.run(D4275.java:23)
Caused by: java.sql.SQLException: The conglomerate (136,832) requested does not
exist.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
... 10 more
Caused by: ERROR XSAI2: The conglomerate (136,832) requested does not exist.
at
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:278)
at
org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(FromBaseTable.java:2352)
at
org.apache.derby.impl.sql.compile.FromList.bindTables(FromList.java:317)
at
org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(SelectNode.java:489)
at
org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(DMLStatementNode.java:199)
at
org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:137)
at
org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:253)
at
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:327)
at
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:85)
at
org.apache.derby.impl.sql.GenericPreparedStatement.rePrepare(GenericPreparedStatement.java:231)
at
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:414)
at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:319)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1242)
... 4 more
Test stopped after 78573 ms
This error does go through the code path with the retry logic, but it doesn't
trigger a retry, so it looks like the invalidation somehow gets lost.
> Intermittent failures in CompressTableTest and TruncateTableTest
> ----------------------------------------------------------------
>
> Key: DERBY-5406
> URL: https://issues.apache.org/jira/browse/DERBY-5406
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.8.2.0, 10.9.0.0
> Reporter: Knut Anders Hatlen
> Assignee: Knut Anders Hatlen
> Attachments: d5406-1a-detect-invalidation-during-compilation.diff
>
>
> The test cases CompressTableTest.testConcurrentInvalidation() and
> TruncateTableTest.testConcurrentInvalidation() fail intermittently with
> errors such as:
> ERROR XSAI2: The conglomerate (2,720) requested does not exist.
> The problem has been analyzed in the comments on DERBY-4275, and a patch
> attached to that issue (invalidation-during-compilation.diff) fixes the
> underlying race condition. However, that patch only works correctly together
> with the fix for DERBY-5161, which was backed out because it caused the
> regression DERBY-5280.
> We will therefore need to find a way to fix DERBY-5161 without reintroducing
> DERBY-5280 in order to resolve this issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira