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/28 09:50:15 UTC

[jira] Created: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
------------------------------------------------------------------------------------------------------------------------

                 Key: DERBY-2711
                 URL: https://issues.apache.org/jira/browse/DERBY-2711
             Project: Derby
          Issue Type: Bug
            Reporter: Anurag Shekhar
            Assignee: Anurag Shekhar
             Fix For: 10.3.0.0


While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Updated: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan updated DERBY-2711:
-----------------------------------

          Component/s: JDBC
    Affects Version/s: 10.3.0.0

> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Updated: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan updated DERBY-2711:
-----------------------------------

    Attachment: derby-2711-3a-additional.diff

'derby-2711-3a-additional.diff' must be committed on top of v2, and does the following:
 * Made variable blob final.
 * Throws exception that was caught and wrapped.
 * Added a comment that the stream will update itself and reflect the new content in all read/skip methods.
 * Changed normal comments into JavaDoc for updateIfRequired.

In addition it removes trailing whitespace and cleans up a few JavaDoc things.

> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711-3a-additional.diff, derby-2711.diff, derby-2711v2.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Commented: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502773 ] 

Kristian Waagan commented on DERBY-2711:
----------------------------------------

Committed 'derby-2711v2.diff' to trunk with revision 545495.
Tests ran cleanly except for the current noise in the tinderbox/nightlies (46+1 failing tests).
A small additional patch with non-functional changes will follow.

Thank you Anurag!

> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711.diff, derby-2711v2.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Updated: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Anurag Shekhar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anurag Shekhar updated DERBY-2711:
----------------------------------

    Attachment: derby-2711v2.diff

In this patch I have addressed points a b and c of Kristian.

a. Resolved conflicts.
b. Removed Excess docs and added link to java.io.InputStream
c. Replaced tab by spaces.

> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711.diff, derby-2711v2.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Updated: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Anurag Shekhar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anurag Shekhar updated DERBY-2711:
----------------------------------

    Attachment: derby-2711.diff

I have introduced a new stream class UpdateableBlobStream to handle the switching from dvd stream to LOBInputStream.
blob.getBinaryStream now returns UpdateableBlobStream is the blob is not yet materialized. This stream keeps tracks of current position of the stream, and checks if blob is materialized since it was last accessed. If the blob is materialized it gets the stream again from blob and updates the stream and sets the position of the stream by calling skip. If the blob has been truncated and now is smaller than the current position user will get an IOException.

Modified Files
  java/engine/org/apache/derby/impl/jdbc/EmbedBlob.java
         getBinaryStream now returns UpdateableBlobStream if the blob is not materialized.
New File
   java/engine/org/apache/derby/impl/jdbc/UpdateableBlobStream.java
         This class handles the switching from dvd stream to LOBInputStream

Tests
java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/BlobUpdateableStreamTest.java
 Added a new test to test switching from dvd stream to LOBInputStream.
java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/_Suite.java
  Added an entry for BlobUpdateableStreamTest.java


 

> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Closed: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Anurag Shekhar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anurag Shekhar closed DERBY-2711.
---------------------------------


> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711-3a-additional.diff, derby-2711.diff, derby-2711v2.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Commented: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502366 ] 

Kristian Waagan commented on DERBY-2711:
----------------------------------------

I'm running tests for the change now.

I have a few requests/questions for the patch:
 a) It can no longer be cleanly applied because of a (trivial) conflict in _Suite (easy to fix)
 b) One line in the new file contains tabs.
 c) Is it necessary to copy all the JavaDoc from InputStream.read? I think a shorter JavaDoc and a reference to InputStream would suffice, but maybe people disagree with this?
 d) Another suggestion, not a requirement, it to rename updateIfRequired to something like updateStream and only call it when necessary. This would require 'if (!materialized && blob.isMaterialized())' all places where updateIfRequired is called currently. This is more a personal preference of mine, so you are free to ignore it :)

I just want to point out that once a Blob has been "materialized", that is transferred from the store to what I tend to call a temporary blob, it cannot go back to be a Blob working on top of a store stream. For this to happen you must reinsert the Blob into the database and fetch it again, thus getting a new Blob object to work on.

The patch looks good functionally, and I expect to commit it tomorrow if the tests run cleanly.

thanks,

> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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


[jira] Resolved: (DERBY-2711) If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan resolved DERBY-2711.
------------------------------------

    Resolution: Fixed

Committed 'derby-2711-3a-additional.diff' to trunk with revision 545501.

> If large blob is updated after InputStream is fetched (using getBinaryStream), the stream continues to point ot old data
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2711
>                 URL: https://issues.apache.org/jira/browse/DERBY-2711
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.3.0.0
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>             Fix For: 10.3.0.0
>
>         Attachments: derby-2711-3a-additional.diff, derby-2711.diff, derby-2711v2.diff
>
>
> While using a large blob (so that blob doesn't gets materialized while fetching from database) getBinaryStream returns stream linked to dvd. After blob is is updated internally the blob data is materialized in LOBStreamControl class but the stream continues to point to dvd hence giving out old data.

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