db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "A B (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-388) Intermittent failures when executing UPDATE trigger statements
Date Thu, 23 Jun 2005 22:44:09 GMT
     [ http://issues.apache.org/jira/browse/DERBY-388?page=all ]

A B updated DERBY-388:
----------------------

    Attachment: derby-388_v2.patch

Thanks for looking at this Satheesh.  Per your suggestion, I looked to see if I could use
prepareStorable() instead of adding the new version of prepare(), and the answer was Yes,
I could.  However, after doing so, I noticed that once a recompilation was determined to be
necessary, we would end up recompiling it EVERY time the trigger was fired thereafter (at
least, that was the case with the repro I've attached to this issue).  So I went back to square
one to see how the trigger-action is compiled to begin with (upon first execution), and realized
that we can and should be following that same codepath when we try to recompile the statement
in mid-trigger processing.

Long story short, it turns out that this patch has become even simpler than it was before--all
I had to do was replace my old changes with a single "if" statement in one class and the problem
was solved.  I'm attaching a new patch that does this; see the comments in the patch for an
explanation of why this simple if-statement does the trick.

So thanks again for the review--it's made for a much simpler patch, and one that seems like
it's generally more correct--at least to me.  If anyone else out there sees a problem with
my approach, please comment. 

I'm attaching the new patch (based on 10.0 codeline) after running "derbylang" on Windows
2000 with Sun jdk 1.4.2 and seeing no failures.  I will run the full "derbyall" suite tonight.

> Intermittent failures when executing UPDATE trigger statements
> --------------------------------------------------------------
>
>          Key: DERBY-388
>          URL: http://issues.apache.org/jira/browse/DERBY-388
>      Project: Derby
>         Type: Bug
>     Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0
>     Reporter: A B
>     Assignee: A B
>      Fix For: 10.0.2.2
>  Attachments: derby-388_v2.patch, go.java
>
> If I define an UPDATE trigger and then I repeatedly perform a table update that fires
the trigger over many rows, I occasionally see intermittent failures of two kinds: 1) a null
pointer exception, and/or 2) a syntax error.
> The NPE stack trace is this:
> java.lang.NullPointerException
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.makeValid(GenericPreparedStatement.java:808)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.rePrepare(GenericPreparedStatement.java:229)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:342)
> 	at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(GenericTriggerExecutor.java:166)
> 	at org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(RowTriggerExecutor.java:108)
> 	at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(TriggerEventActivator.java:296)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.fireAfterTriggers(UpdateResultSet.java:824)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:292)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1271)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:259)
> The syntax error stack trace is this:
> ERROR 42X01: Syntax error: org.apache.derby.iapi.db.Factory::getTriggerExecutionContext.
> 	at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:311)
> 	at org.apache.derby.impl.sql.compile.MethodCallNode.resolveMethodCall(MethodCallNode.java:666)
> 	at org.apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression(StaticMethodCallNode.java:455)
> 	at org.apache.derby.impl.sql.compile.NonStaticMethodCallNode.bindExpression(NonStaticMethodCallNode.java:170)
> 	at org.apache.derby.impl.sql.compile.NonStaticMethodCallNode.bindExpression(NonStaticMethodCallNode.java:170)
> 	at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.bindExpression(JavaToSQLValueNode.java:250)
> 	at org.apache.derby.impl.sql.compile.CastNode.bindExpression(CastNode.java:224)
> 	at
> [snip]
> org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(DMLStatementNode.java:247)
> 	at org.apache.derby.impl.sql.compile.UpdateNode.bind(UpdateNode.java:507)
> 	at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:332)
> 	at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:107)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.makeValid(GenericPreparedStatement.java:811)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.rePrepare(GenericPreparedStatement.java:229)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:342)
> 	at org.apache.derby.impl.sql.execute.GenericTriggerExecutor.executeSPS(GenericTriggerExecutor.java:166)
> 	at org.apache.derby.impl.sql.execute.RowTriggerExecutor.fireTrigger(RowTriggerExecutor.java:108)
> 	at org.apache.derby.impl.sql.execute.TriggerEventActivator.notifyEvent(TriggerEventActivator.java:296)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.fireAfterTriggers(UpdateResultSet.java:824)
> 	at org.apache.derby.impl.sql.execute.UpdateResultSet.open(UpdateResultSet.java:292)
> 	at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:366)
> 	at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1100)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1271)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:259)
> In both cases, it looks like the error happens when Derby decides (internally) to recompile
the trigger-action statement in the middle of trigger processing--depending on the state of
the underlying Statement object that performs the trigger action, the result will be an NPE
or a syntax error.
> I'm working on writing up a simplified reproduction and will post soon...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message