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 "Kristian Waagan (JIRA)" <ji...@apache.org> on 2009/01/16 11:30:00 UTC

[jira] Created: (DERBY-4023) Improve length caching in TemporaryClob

Improve length caching in TemporaryClob
---------------------------------------

                 Key: DERBY-4023
                 URL: https://issues.apache.org/jira/browse/DERBY-4023
             Project: Derby
          Issue Type: Improvement
          Components: JDBC
    Affects Versions: 10.4.2.0, 10.5.0.0
            Reporter: Kristian Waagan
            Priority: Minor


TemporaryClob doesn't save the known length of the Clob in all situations.
The following places in the code should be improved (some easier than others):
 a) TemporaryClob(String,ConChild)
 b) copyClobContent(InternalClob,long) (non-static)
 c) copyClobContent(InternalClob) (non-static)

There might be additional places to fix too.

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


[jira] Resolved: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan resolved DERBY-4023.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.5.1.1

I created a subtask for the remaining work, since the patches will go into different releases. The comments regarding patch 2a will be addressed there.

Resolving this issue.

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.1.1
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.5.1.1
>
>         Attachments: derby-4023-1a-cache_length_simple.diff, derby-4023-2a-utf8_aware_copy_content.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Commented: (DERBY-4023) Improve length caching in TemporaryClob

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681671#action_12681671 ] 

Knut Anders Hatlen commented on DERBY-4023:
-------------------------------------------

Your comment mentions a 2b patch, but I only see 2a.

Assuming that you meant 2a, the patch basically looks good to me. A couple of minor comments:

- copyUtf8Data's javadoc doesn't say what it's supposed to return

- "if ((c & 0x80) == 0x00) { // 8th bit set (top bit)" should say "8th bit *not* set"

- since copyUtf8Data always uses buffered reads, would it make sense not to wrap a BufferedInputStream around the raw stream in copyClobContent now?

- error messages are not internationalized (should the detailed messages be asserts instead? the assert in copyClobContent and the EOFException in copyUtf8Data test the same thing, so perhaps only one is needed?)

- is the chars variable in copyUtf8Data needed, or could charCount be incremented directly?

- can the stream that is passed into copyUtf8Data ever contain less than 3 bytes? If so, the check for the EOF marker will fail.

- There's the following line in copyUtf8Data: offset = offset % readNow; // Starting offset for next iteration
     Would it be safer if it used minus instead of remainder? I was thinking of the (perhaps unlikely) case where readNow is 1 and offset>1.

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.5.0.0
>
>         Attachments: derby-4023-1a-cache_length_simple.diff, derby-4023-2a-utf8_aware_copy_content.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Updated: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan updated DERBY-4023:
-----------------------------------

    Derby Info: [Patch Available]

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4023-1a-cache_length_simple.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Assigned: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan reassigned DERBY-4023:
--------------------------------------

    Assignee: Kristian Waagan

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Closed: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan closed DERBY-4023.
----------------------------------


Closing. Added a link to DERBY-4241, which describes more work that can be done to improve the performance of certain LOB operations,

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.1.1
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.5.1.1
>
>         Attachments: derby-4023-1a-cache_length_simple.diff, derby-4023-2a-utf8_aware_copy_content.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Updated: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan updated DERBY-4023:
-----------------------------------

    Attachment: derby-4023-2a-utf8_aware_copy_content.diff

Patch 2b adds a UTF-8 aware copy method.
It avoids having to decode the stream first to calculate the byte length based on the character length.
With a CLOB of 30 MB:
 o testLargeClobGetLengthModified :  9814 ms to 7009 ms
 o testLargeClobTruncateLengthMinusOne : 2538 ms to 1455 ms

This is work in progress, I haven't run the regression tests yet.
Patch ready for review.

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.5.0.0
>
>         Attachments: derby-4023-1a-cache_length_simple.diff, derby-4023-2a-utf8_aware_copy_content.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Commented: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan commented on DERBY-4023:
----------------------------------------

suites.All ran without failures (10856 tests) on Solaris 10 with JDK 1.6.

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4023-1a-cache_length_simple.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Updated: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan updated DERBY-4023:
-----------------------------------

       Derby Info:   (was: [Patch Available])
    Fix Version/s: 10.5.0.0

Committed patch 1a to trunk with revision 737000.

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.5.0.0
>
>         Attachments: derby-4023-1a-cache_length_simple.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Updated: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan updated DERBY-4023:
-----------------------------------

    Attachment: derby-4023-1a-cache_length_simple.diff

Patch 1a caches the length for cases a) and b).
Patch ready for review.

Unfortunately, case c) is the most common one but it is not as easy to fix.
I think there are two main solutions:
 1) Add method InternalClob.getLengthIfKnow.
 2) Make LOBInputStream.copyBytes UTF-8 aware and count the characters (or add second copy method).

I think the two solutions can be combined as well, doing 2 only when the length is unknown.

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4023-1a-cache_length_simple.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Commented: (DERBY-4023) Improve length caching in TemporaryClob

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

Kristian Waagan commented on DERBY-4023:
----------------------------------------

Regression tests ran cleanly.

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>             Fix For: 10.5.0.0
>
>         Attachments: derby-4023-1a-cache_length_simple.diff, derby-4023-2a-utf8_aware_copy_content.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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


[jira] Updated: (DERBY-4023) Improve length caching in TemporaryClob

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

Myrna van Lunteren updated DERBY-4023:
--------------------------------------

    Fix Version/s:     (was: 10.5.0.0)

> Improve length caching in TemporaryClob
> ---------------------------------------
>
>                 Key: DERBY-4023
>                 URL: https://issues.apache.org/jira/browse/DERBY-4023
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.4.2.0, 10.5.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-4023-1a-cache_length_simple.diff, derby-4023-2a-utf8_aware_copy_content.diff
>
>
> TemporaryClob doesn't save the known length of the Clob in all situations.
> The following places in the code should be improved (some easier than others):
>  a) TemporaryClob(String,ConChild)
>  b) copyClobContent(InternalClob,long) (non-static)
>  c) copyClobContent(InternalClob) (non-static)
> There might be additional places to fix too.

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