You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Przemo Pakulski (JIRA)" <ji...@apache.org> on 2008/10/21 12:10:44 UTC

[jira] Created: (JCR-1825) DBDataStore doesn't support concurrent reads

DBDataStore doesn't support concurrent reads
--------------------------------------------

                 Key: JCR-1825
                 URL: https://issues.apache.org/jira/browse/JCR-1825
             Project: Jackrabbit
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: 1.5.0
            Reporter: Przemo Pakulski
             Fix For: 1.5.0


My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.

After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Commented: (JCR-1825) DBDataStore doesn't support concurrent reads

Posted by "Przemo Pakulski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641343#action_12641343 ] 

Przemo Pakulski commented on JCR-1825:
--------------------------------------

without doing major changes I suggest to change DBDataStore class as follow :

Index: src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
===================================================================
--- src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java	(revision 706573)
+++ src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java	(working copy)
@@ -519,6 +519,9 @@
                 if (copyWhenReading) {
                     File temp = moveToTempFile(result);
                     result = new TempFileInputStream(temp);
+                    DatabaseHelper.closeSilently(rs);
+                    putBack(conn);
+                    rs = null;
                 }
             }

and DbResources.java close method to do not free db resources twice :

    public void close() {
        if (!closed) {
            closed = true;
            if (rs!=null) {
              DatabaseHelper.closeSilently(rs);
              try {
                store.putBack(conn);
              } catch (Exception e) {
                log.info("Closing DbResources: ", e);
              }
            }
        }
    }

Is it ok ?

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Commented: (JCR-1825) DBDataStore doesn't support concurrent reads

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643222#action_12643222 ] 

Jukka Zitting commented on JCR-1825:
------------------------------------

Instead of tweaking the copyWhenReading workaround (which disables one of the main benefits of the data store, i.e. the ability to access a binary property without intermediate copies being created), I'd simply remove the maxConnections limit from the connection pool.

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>         Attachments: patch.txt, patch2.txt
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Updated: (JCR-1825) DBDataStore doesn't support concurrent reads

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

Thomas Mueller updated JCR-1825:
--------------------------------

    Attachment: patch2.txt

New patch (I still didn't test it however).
'DbResources' should be renamed to 'DbResource', I will do that later.

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>         Attachments: patch.txt, patch2.txt
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Commented: (JCR-1825) DBDataStore doesn't support concurrent reads

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641362#action_12641362 ] 

Thomas Mueller commented on JCR-1825:
-------------------------------------

Hi,

You are right, this part of the code doesn't do any more what it's supposed to do. There is another problem: it doesn't work if the stream is null. Also some of the DbResources methods are not not used and should be removed.

I am currently working on another patch, I will attach it in an hour or so to this bug.

Thanks for finding this problem!

Regards,
Thomas

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Commented: (JCR-1825) DBDataStore doesn't support concurrent reads

Posted by "Przemo Pakulski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641372#action_12641372 ] 

Przemo Pakulski commented on JCR-1825:
--------------------------------------

Cannot see important 2 lines responsible for freeing resources are missing in 'copyWhenReading' block

if (copyWhenReading) {
    File temp = moveToTempFile(result);
    result = new TempFileInputStream(temp);
  + DatabaseHelper.closeSilently(rs);
  + putBack(conn); 
    dbResources = new DbResources(result);
}

I do not follow changes in DbInputStream class, but I assume they are not so important.

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>         Attachments: patch.txt
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Issue Comment Edited: (JCR-1825) DBDataStore doesn't support concurrent reads

Posted by "Przemo Pakulski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641372#action_12641372 ] 

ppakulski edited comment on JCR-1825 at 10/21/08 6:13 AM:
----------------------------------------------------------------

Cannot see important 2 lines responsible for freeing resources in 'copyWhenReading' block

if (copyWhenReading) {
    File temp = moveToTempFile(result);
    result = new TempFileInputStream(temp);
  + DatabaseHelper.closeSilently(rs);
  + putBack(conn); 
    dbResources = new DbResources(result);
}

I do not follow changes in DbInputStream class, but I assume they are not so important.

      was (Author: ppakulski):
    Cannot see important 2 lines responsible for freeing resources are missing in 'copyWhenReading' block

if (copyWhenReading) {
    File temp = moveToTempFile(result);
    result = new TempFileInputStream(temp);
  + DatabaseHelper.closeSilently(rs);
  + putBack(conn); 
    dbResources = new DbResources(result);
}

I do not follow changes in DbInputStream class, but I assume they are not so important.
  
> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>         Attachments: patch.txt
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Resolved: (JCR-1825) DBDataStore doesn't support concurrent reads

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

Thomas Mueller resolved JCR-1825.
---------------------------------

    Resolution: Fixed

Committed in revision 708598.

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>         Attachments: patch.txt, patch2.txt
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Commented: (JCR-1825) DBDataStore doesn't support concurrent reads

Posted by "Claus Köll (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641374#action_12641374 ] 

Claus Köll commented on JCR-1825:
---------------------------------

i would also prefer to use the closeSilently Method from the DatabaseHelper instead of ConnectionRecoveryManager
so we can delete the Method in the ConnectionRecoveryManager

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>         Attachments: patch.txt
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Commented: (JCR-1825) DBDataStore doesn't support concurrent reads

Posted by "Przemo Pakulski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12641336#action_12641336 ] 

Przemo Pakulski commented on JCR-1825:
--------------------------------------

Without setting copyWhenReading  to true usage of DBDataStore is dangerous, could be a bottleneck depending how long streams are kept open.
If streams are not closed DBDataStore hangs/locks.

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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


[jira] Updated: (JCR-1825) DBDataStore doesn't support concurrent reads

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

Thomas Mueller updated JCR-1825:
--------------------------------

    Attachment: patch.txt

Here is my first patch. I didn't test it yet; I post it just so that others can have a look at it.

> DBDataStore doesn't support concurrent reads
> --------------------------------------------
>
>                 Key: JCR-1825
>                 URL: https://issues.apache.org/jira/browse/JCR-1825
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 1.5.0
>            Reporter: Przemo Pakulski
>             Fix For: 1.5.0
>
>         Attachments: patch.txt
>
>
> My understanding is that setting parameter copyWhenReading to true should allow concurrent reads by spooling binary property to temporary file and free database resources (connection) immediately to make it available for other threads.
> After applying patch for JCR-1388, DBDataStore doesn't support concurrent reads anymore, resultSet is kept open and db connection is blocked until the stream is read and closed. When copyWhenReading is set to true db connection should be released immediately, this is the reason i guess why temporary file is used.

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