[
https://issues.apache.org/jira/browse/DERBY-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547328
]
Kathey Marsden commented on DERBY-3238:
---------------------------------------
In an UpdateResultSet row there is a column for each "before" value and another
column for the "after" value. When a trigger is present all columns are pulled
in as update columns even if they are not updated, so each column has a
duplicate column values in the row. In this case, the BLOB column was not
updated, so the before value and the after value point to the same stream.
The before value gets materialized in getNextRowCore->
DMLWriteResultSet.getNextRowCore(), but the after value does not get updated
at that time. Later in collectAffectedRows we try to materialize the after
value by calling objectifyStream on the after columns, but because the stream
was already read, we get the EOFException.
It seems there are a few options.
1) Try to fix DERBY-1482 so that the non-updated columns don't even show up in
the UpdateResultSet or at least we don't have to materialize them (hard?).
2) Try to make sure that duplicate columns in the row get updated when the
stream is originally loaded. I am looking at this, but am not sure exactly the
best place in the code to copy the stream value.
3) Something more clever. Ideas?
> When table contains large LOB values (> ~32K) trigger execution fails for
> that row with ERROR XCL30: An IOException was thrown when reading a 'BLOB'
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-3238
> URL: https://issues.apache.org/jira/browse/DERBY-3238
> Project: Derby
> Issue Type: Bug
> Affects Versions: 10.1.3.1, 10.2.2.0, 10.3.1.4, 10.3.2.1, 10.4.0.0
> Reporter: Stan Bradbury
> Attachments: blob_insert2.java
>
>
> See attached test case.
> At execution/run-time a trigger that handles a row that contains a large LOB
> value will fail with the following error and stack trace:
> = = =
> Testing blob of size=1024
> . . Now executing update to fire the trigger
> PASSED
> Testing blob of size=16384
> . . Now executing update to fire the trigger
> PASSED
> Testing blob of size=32658
> . . Now executing update to fire the trigger
> PASSED
> Testing blob of size=32659
> . . Now executing update to fire the trigger
> Error! java.sql.SQLException: An IOException was thrown when reading a 'BLOB'
> from an InputStream.
> java.sql.SQLException: An IOException was thrown when reading a 'BLOB' from
> an InputStream.
> at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
> at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown
> Source)
> at blob_insert2.testBlob(blob_insert2.java:102)
> at blob_insert2.main(blob_insert2.java:55)
> Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
> at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown
> Source)
> ... 9 more
> Caused by: java.io.EOFException
> at org.apache.derby.iapi.types.SQLBinary.readBinaryLength(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.execute(Unknown
> Source)
> ... 5 more
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.