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

Knut Anders Hatlen updated DERBY-3889:
--------------------------------------

    Attachment: derby-3889-1a.stat
                derby-3889-1a.diff

derby-3889-1a.diff changes LOBStreamControl so that it deletes the temporary 
file when truncate() switches from file to memory. Since we have three 
different places in the code that need to do the same set of operations when a 
temporary file is discarded, I factored it out in a separate method, 
releaseTempFile().

I also moved the field lobFile (of type StorageFile) from LOBStreamControl to 
LOBFile, since it should always be in sync with the field tmpField (of type 
LOBFile) and the current handling of those fields is a bit confusing (for 
instance, we only null out tmpFile in free() and truncate(), which works since 
we always check for tmpFile==null instead of lobFile==null, but it leaves 
LOBStreamControl in a confusing state). By making it a final field in LOBFile, 
we automatically get consistency between the two, and the new method 
releaseTempFile() becomes a one-argument method instead of a two-argument 
method.

Derbyall and suites.All ran cleanly with the patch, and I have manually 
verified that the uploaded repro does not create thousands of temporary files.

> LOBStreamControl.truncate() doesn't delete temporary files
> ----------------------------------------------------------
>
>                 Key: DERBY-3889
>                 URL: https://issues.apache.org/jira/browse/DERBY-3889
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.1.4, 10.4.2.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-3889-1a.diff, derby-3889-1a.stat, TruncateClob.java
>
>
> If LOBStreamControl.truncate() reduces the size of the lob so that it fits in 
> the internal buffer, it closes the temporary file, but it doesn't remove it. 
> See the attached Java class (TruncateClob.java) which fills the tmp directory 
> with temporary lob files, even if each lob is explicitly freed.

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

Reply via email to