|
[
Permlink
| « Hide
]
Kathey Marsden added a comment - 01/May/05 02:19 PM
repro for setCharacterStream holding locks after retrieving BLOB/CLOB data greater than 32K
This fixes Closing a resultset after retriving BLOB or CLOB data > 32K, does not release locks properly. Network server/client materializes the LOB on the client and cannot differentiate getBlob from getBytes or getBinaryStream. Previously, network server would always call getBlob/getClob for any lob related call. This change changes network server to use getBytes/getString and not hold locks for any of the calls. The implementation adds a new class EXTDTAInputStream to network server to localize the stream handling for large objects. This should make it easier to adjust in the future as improvements are made in the large object handling. Because we need a length in order to write a stream, EXTDTAInputStream currently call getBytes or getString to get the length and stream out that object. This is apparently required because we cannot reset the input stream after traversing it to get the length. Future suggestions for changes to network server to handle this in a more complete way would be to: 1) Change DDMWriter.writeScalarStream to not require a length and optimize EXTDTAObjectInputStream accordingly 2) Add support for lob locators with network server. The getBlob, getClob calls would use the locators and would hold locks until the end of the transaction. Checked this in with revision 179014.
Sending java\drda\org\apache\derby\impl\drda\DDMWriter.java Sending java\drda\org\apache\derby\impl\drda\DRDAConnThread.java Adding java\drda\org\apache\derby\impl\drda\EXTDTAInputStream.java Sending java\testing\org\apache\derbyTesting\functionTests\master\DerbyNet\blobclob4BLOB.out Sending java\testing\org\apache\derbyTesting\functionTests\master\DerbyNetClient\blobclob4BLOB.out Sending java\testing\org\apache\derbyTesting\functionTests\master\blobclob4BLOB.out Sending java\testing\org\apache\derbyTesting\functionTests\tests\jdbcapi\blobclob4BLOB.java Transmitting file data ....... Committed revision 179014. Checked in svn 179017 + 179198 to resolve this issue.
Sunitha and I chatted on IRC about
* Since we cannot traverse the stream twice to get length and then data Network Server currently does getBytes for Blob calls and needs sufficient JVM memory allocated. * Real solution is 1) 2) to getBlob vs getBinaryStream for locking. * As an aside noted that the embedded Blob.length() call could probably use available(), skip() to improve performance instead of reading the data. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||