You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Anurag Shekhar (JIRA)" <ji...@apache.org> on 2007/05/30 17:03:15 UTC

[jira] Updated: (DERBY-2729) temporary lob file should be cleaned when the transaction or connection is no longer valid.

     [ https://issues.apache.org/jira/browse/DERBY-2729?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anurag Shekhar updated DERBY-2729:
----------------------------------

    Attachment: derby-2729.diff

Life cycle of a lob object is within the a transaction. when a connection is closed or a rollback or commit is called, either explicitly by calling 
connection.commit or connection.rollback, or a rollback called due to an 
exception with severity  TRANSACTION or higher or an implicit commit when 
autoCommit is set to true.

Locator patch for client has introduced a hash map (lobHashMap) in 
EmbeddedConnection to track all the lob associated with the connection 
and at commit, rollback and close clearHashMap method is called to 
cleanup the hashmap and calling free method on individual hash map.


I am relying on same methods to do cleanup for embedded server. 
In the constructor of EmbedBlob calls EmbeddedConnection.addLOBMapping method to add entry for the blob.

I have also added code to call clearLOBMapping when transaction is commited when autoCommit mode is on. And when an StandardException with severity TRANSACTION or higher.

Due to this change the EmbeddedBlob now any call to EmbeddedBlob after commit or rollback now results in exception with SQLState set to SQLState.LOB_OBJECT_INVALID. I have added additional check to see if connection is closed, this ensures the same sql state what is thrown right now without this patch.
Its not possible to determine whether the blob was closed due to explicit call to free or its because transaction is no more valid. So if a blob is accessed after commit/rollback it results in SQLException with SQL state set to  SQLState.LOB_OBJECT_INVALID.

modified files
java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
added code to call clearLOBMapping in commitIfNeeded, commitIfAutoCommit and handleException methods. 


java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java

added call to EmbedConnection to add entry for this object in lobMapping. 
added additional check for validity of connection in checkValidity

java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobClob4BlobTest.java
updated the expected SQLStates.      

java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobStoredProcedureTest.java
updated the expected locator id. Now blob constructor is adding itself to  the lob so the id received by the stored procedure will be different. 


> temporary lob file should be cleaned when the transaction or connection is no longer valid.
> -------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2729
>                 URL: https://issues.apache.org/jira/browse/DERBY-2729
>             Project: Derby
>          Issue Type: Bug
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2729.diff
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.