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

Mamta A. Satoor commented on DERBY-5277:
----------------------------------------

Trigger action SPSes get marked invalid at the time of upgrade. When such a 
trigger fires again, we regenerate the trigger action SPS. This regeneration 
looks at SYSTRIGGERS to find out what columns are being used through the 
REFERENCING CLAUSE and uses them to find the relative column positions of those 
columns in the regenerated trigger action. At the time of upgrade, this 
information will be available in SYSTRIGGER if the trigger was        created 
in 10.7.1.1. But for all the other releases, SYSTRIGGERS does not have that     
information because that informaiton was never collected for the triggers in 
those releases. Because of this, the regenerated trigger action SPS will assume 
that all the columns will be read from the trigger table and hence it will use 
the absolute column         positions of those columns in the trigger table in 
the regenerated trigger action SPS.  This will cause such triggers to not be 
able to use the performance enhancement of selective column reading from the 
trigger table and hence even though not all the columns from the trigger table 
table are required by the triggering sql and firing triggers, we will read all 
the columns. One fix for this can be that when a trigger fires and it finds 
that it's trigger action SPS is invalid, then trigger should check if it uses 
REFERENCING clause and if the trigger action column information is missing from 
the SYSTRIGGERS, then it should drop and recreate the trigger with the trigger 
action column information collected and then regenerate the trigger action SPS 
based on it. Doing this will make Derby not read the columns not needed by the 
firing trigger and triggering sql. I will look into this to see what work is 
involved in collecting the trigger action column information for the triggers 
with that info missing. This should only happen for the triggers which are not 
created in 10.9 and higher because only releases prior to 10.9 (with the 
exception of 10.7.1.1) didn't collect the information about trigger action 
columns.


> Intermittent OutOfMemoryErrors in BasicSetup.testTriggersWithLOBcolumns()
> -------------------------------------------------------------------------
>
>                 Key: DERBY-5277
>                 URL: https://issues.apache.org/jira/browse/DERBY-5277
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.9.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Mamta A. Satoor
>
> Seen many times in the JDK 7 tests lately, and also in the Tinderbox. First 
> occurrence was here: 
> http://dbtg.foundry.sun.com/derby/test/Daily/jvm1.7/testing/testlog/sol32/1134678-suitesAll_diff.txt
> (There had been no commits in the last two days before this test run, so it's 
> difficult to say if a recent change caused it.)
> The test case has a comment that says that it should never read the LOB into 
> memory, but according to the stack trace, that's exactly what's happening:
> Caused by: java.lang.OutOfMemoryError: Java heap space
>       at org.apache.derby.iapi.types.SQLBinary.readFromStream(Unknown Source)
>       at org.apache.derby.iapi.types.SQLBinary.readExternal(Unknown Source)
>       at org.apache.derby.iapi.types.SQLBinary.getValue(Unknown Source)
>       at org.apache.derby.iapi.types.SQLBinary.loadStream(Unknown Source)
>       at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.objectifyStream(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(Unknown 
> Source)
>       at org.apache.derby.impl.sql.execute.UpdateResultSet.open(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
>       at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>       at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown 
> Source)
>       at 
> org.apache.derbyTesting.functionTests.tests.upgradeTests.BasicSetup.testTriggersWithLOBcolumns(BasicSetup.java:854)

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


Reply via email to