You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Martin Perez (JIRA)" <ji...@apache.org> on 2006/02/02 14:37:03 UTC

[jira] Created: (JCR-313) Allow to configure DB persistence managers through JDNI

Allow to configure DB persistence managers through JDNI
-------------------------------------------------------

         Key: JCR-313
         URL: http://issues.apache.org/jira/browse/JCR-313
     Project: Jackrabbit
        Type: Improvement
    Versions: 0.9    
    Reporter: Martin Perez


Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 

It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 

This could be a sample configuration :

<PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
       <param name="dataSource" value="jdbc/JackrabbitDS"/>

        
       .... think also about a way to pass params to data source, it should be simple ....

       <param name="schema" value="mysql"/>
       <param name="schemaObjectPrefix" value="${
wsp.name}_"/>
       <param name="externalBLOBs" value="false"/>
   </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-313?page=all ]

Jukka Zitting updated JCR-313:
------------------------------

    Fix Version: 1.0

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>      Fix For: 1.0

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12364957 ] 

Marcel Reutegger commented on JCR-313:
--------------------------------------

> Concurrency, performance and transactionability will be highly boosted with this approach.

Why do you think that using a DataSource instead of a plain SQL Connection has any impact on concurrency, performance or transactions?

There are certainly benefits using pooled connections, but in my opinion this is solely ease of configuration in a J2EE container and detection of broken connections.

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-313?page=all ]

Jukka Zitting updated JCR-313:
------------------------------

    Version: 1.0

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9, 1.0
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.1
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-313?page=all ]

Jukka Zitting updated JCR-313:
------------------------------

    Comment: was deleted

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.1
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-313?page=all ]

Jukka Zitting reassigned JCR-313:
---------------------------------

    Assign To: Jukka Zitting

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-313?page=all ]
     
Jukka Zitting resolved JCR-313:
-------------------------------

    Resolution: Fixed

Fixed in revisions 386838 - 386848. As described above, there are now abstract DatabasePersistenceManager and DatabaseFileSystem base classes that both contain an abstract getConnection() factory method (I refactored the initConnection() from JCR-355 as IMO it's cleaner the less subclasses know about base class internals) that subclasses need to implement. The existing "simple" subclasses implement this method using the JDBC DriverManager, and the added JNDI subclasses use a DataSource located using JNDI.

I also added a protected DatabasePersistenceManager.closeConnection() method to avoid having to override the full close() method in DerbyPersistenceManager. I haven't yet applied the same solution to the DatabaseFileSystem class as I think that there might be a better way to handle this. More on this on the mailing list.

I've added javadoc warnings about the long lifetime of the connections acquired by the database classes. This should cover Marcel's concerns at least somewhat, but I think that there is a better solution to this problem as well. Again, more soon on the mailing list.

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9, 1.0
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.1
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12365062 ] 

Marcel Reutegger commented on JCR-313:
--------------------------------------

Martin wrote:
> Well, first of all, sorry if I offended someon putting the issue, because it seems that I got hard responses.

You don't have to be sorry. I'm not against building a DB PM that uses a connection pool. I just had (and still have) doubts how this contributes to increased concurrency, because concurrency is mostly controlled outside of the PM.

It wasn't my intention to criticise anyone on a personal level.

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12365006 ] 

Jukka Zitting commented on JCR-313:
-----------------------------------

Martin:
> [OT]: Well, first of all, sorry if I offended someon putting the issue, because it seems that I got hard responses.

Don't be sorry. This is a valid and good idea that deserves to be thoroughly discussed.

My undestanding is that the basic idea of Jackrabbit is that it is fully in control of the content a repository contains. Although the persistence model is highly configurable, the default Jackrabbit configuration has traditionally been to store data either directly in the filesystem or more recently to use an embedded database. The idea is that Jackrabbit provides a service that is at the same architectural level as a RDBMS (i.e. the backend), and that layering Jackrabbit on top of a separate backend system doesn't make much sense.

The lack of advanced deployment options (storage clustering, etc.) and administrative tools make however the option of storing the actual data in a separate database server quite attractive. Jackrabbit should therefore offer first-class support for remote databases as well as embedded ones as persistence options.

I can volunteer to take a deeper look at the required changes and whether separate embedded/external database persistence managers are needed.


> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Martin Perez (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12366676 ] 

Martin Perez commented on JCR-313:
----------------------------------

- It makes all the sense to move the JNDI handling to a base class, as it could be used by all the specializations.

- Sure, even more: 3) Without closing connections it would be very easy to exhaust the application server connection pool, and I don't think the server admin would like this to happen when other applications could share the same pool.

- I do not understand Marcel's 3 point. Also, I do not know why connections must be returned. I have been looking at the code and it is cleat that prepared statements cannot be used on that way, and also, the connection cannot be keeped. In traditional J2EE applications you should obtain a connection and close it (and by consequende the pstmt) on the same method. Why can this be done? 

Martin


> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12366762 ] 

Marcel Reutegger commented on JCR-313:
--------------------------------------

What I was trying to say is: the current Simple DB PM uses prepared statements for all of the DB operations. Those prepared statements are kept for the full lifetime of the PM and only closed when the PM is shut down.
A more general DB PM that uses a DataSource (pool) will not be able to use such long lived prepared statements. After a store operation it should close (return) the connection. Because the life time of a statement is bounded to the connection, the PM will have to close the statements as well and create new ones when the next store() occurs.

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12366615 ] 

Marcel Reutegger commented on JCR-313:
--------------------------------------

Thanks Jukka for taking the initiative on this issue. If everyone else is ok with implementing JNDI support in the SimpleDbPersistenceManager that's also fine with me. But a have a few concerns that I'd like to express:

- I share Brians opinion to create a separate implementation that is JNDI enabled and move the common logic into a base class. The main reason here is to keep the existing implementation simple.

- The implementation that uses JNDI should not keep the connection that it gets from the datasource. There are several reasons why this is not desirable: 1) there might be a connection timeout in the datasource that will revoke the connection given to the PM, 2) if the connection is broken due to a network failure, the PM would have to recover from that failure. But this is exactly the responsibility of a DataSource.
One of the concerns with the current simple implementation is that it does not make use of a pool (DataSource), the JNDI enabled PM should address this.

- With the previous point in mind, a JNDI enabled PM will not be able to use prepared statements over multiple store() operations, because it should return the connection. This will probably have a significant impact on the implementation of the PM. So, I'm not sure how much of the current Simple DB PM can acutally be reused.


> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Martin Perez (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12365003 ] 

Martin Perez commented on JCR-313:
----------------------------------

[OT]: Well, first of all, sorry if I offended someon putting the issue, because it seems that I got hard responses. Take in mind that I only wanted to help when one person of your team asked to someone to put the issue. I do not have special interest on this topic, even taking in mind that I think that it would be a good improvement.

> Why do you think that using a DataSource instead of a plain SQL Connection has any impact on concurrency, performance or transactions? 

Well, with all the respects, one simple reason to boost concurrency, performance and transactions is that is the application server who manages the resources, and not you manually. This is enough to justify, nor only because modern application servers can perform extra optimizations on db connections and by consequence impacting on the three items above, but the extra system security layer that you get. Accessing in a non-managed way to managed resources from managed environments is always, at least, not-the-better option, but this is only my opinion.

And after that reason, that I think is the most important, we could start to talk about connection pooling, transactions or synchronization. Anyways, I'm not going into that as it was being discussed on the list. I endorse most of the comments given there. Yes, I know, like you said (and you did a great and very instructive response), that many of the items exposed do not always happen, or that they are not quite true. But they can happen, and in that case jackrabbit won't scale, and that is the really important thing, and by consequence all the three items exposed above will be decreased.

>i wouldn't be against a more elaborate JDBC based PM implementation that makes use of J2EE infrastructure features such as JNDI lookup of the DataSource, etc.

Sure! If you want to add more things than JNDI support, maybe it could be worthwile. You can know that better than I , as you know better the code. But ( and please, forgive me because I'm talking without deeply SDPM knowledge) it seems to me that adding a DataSource lookup method should not be very difficult. My only doubt if it will be enough with a simple InitialContext instantiation or you will need to start thinking about passing special parameters to the JNDI environment. And well, if you have the lookup, then all the code is done; you only have to add the necessary close() methods.

Also, think that you have to evaluate if it has sense to have two different generic database persistence manager. For me, I think that is better and also less confusing for the final users to have a single good database persistence manager. But again, this is only my opinion.





> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-313?page=all ]

Jukka Zitting updated JCR-313:
------------------------------

    Attachment: dbpm-jndi.patch

Attached a minimal and untested patch for adding support for DataSources bound in JNDI. It allows one to optionally configure a JNDI path as the dataSourceLocation configuration parameter instead of configuring the traditional driver/url/user/password parameters. If the dataSourceLocation parameter is given, then a JNDI lookup is made to get the DataSource and a Connection is acquired using DataSource.getConnection(). Otherwise the traditional configuration parameters are used.

Would this be a good enough way to resolve this issue, or should we make a general DatabasePersistenceManager base class that contains most of the current SimpleDbPersistenceManager functionality and use separate SimpleDbPersistenceManager and JndiDbPersistenceManager subclasses for handling the different configuration mechanisms?

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/JCR-313?page=all ]

Jukka Zitting updated JCR-313:
------------------------------

    Fix Version: 1.1
                     (was: 1.0)

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.1
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Brian Moseley (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12366583 ] 

Brian Moseley commented on JCR-313:
-----------------------------------

since DerbyPersistenceManager subclasses SimpleDbPersistenceManager to add logic for shutting down the db server, it's not going to be useful for j2ee-managed connections.

i like the idea of extracting a base class and then adding the jndi support to a J2eeDbPersistenceManager or some such subclass. i'd also suggest renaming DerbyPersistenceManager to, say, EmbeddedDerbyPersistenceManager to further highlight the environment it's meant to be used in.

i'd also like to see this change made to DbFilesystem.

thanks jukka!


> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12366596 ] 

Jukka Zitting commented on JCR-313:
-----------------------------------

> since DerbyPersistenceManager subclasses SimpleDbPersistenceManager to add logic for shutting down the db server,
> it's not going to be useful for j2ee-managed connections. 

Good point. It seems that a common DatabasePersistenceManager is a better alternative.

> i'd also like to see this change made to DbFilesystem. 

I'll take a look at that as well.

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12364958 ] 

Stefan Guggisberg commented on JCR-313:
---------------------------------------

the goals of the SimpleDbPersistenceManager implementation have been,
as its name suggests, being *simple*, having zero deployment requiremnts 
and minimal dependencies. it's predestined to be used with embedded 
databases such as e.g. Derby. 

the requested features would just add complexity, deployment overhead and no
real benefit  for the above use case and would defeat the original purpose of the
SimpleDbPersistenceManager.

i wouldn't be against a more elaborate JDBC based PM implementation that makes 
use of J2EE infrastructure features such as JNDI lookup of  the DataSource, etc.

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Serge Huber (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12365060 ] 

Serge Huber commented on JCR-313:
---------------------------------

Well I agree that it might be best to keep the simple DB PM very simple.

We might have to modify it to be able to re-use code between the simple and a (slightly) more complex DB PM.

One thing I liked in one of the DB PMs that was done by Edgar I think was to externalize the SQL requests so that it would be easy at deployment time to modify the table and column names, as it may be necessary when conflicting with some applications. This is just an idea of the requirements to seperate this from a "simple" implementation.



> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez

>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (JCR-313) Allow to configure DB persistence managers through JDNI

Posted by "Stefan Guggisberg (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/JCR-313?page=comments#action_12366668 ] 

Stefan Guggisberg commented on JCR-313:
---------------------------------------

i fully agree with all of marcel's concerns.

> Allow to configure DB persistence managers through JDNI
> -------------------------------------------------------
>
>          Key: JCR-313
>          URL: http://issues.apache.org/jira/browse/JCR-313
>      Project: Jackrabbit
>         Type: Improvement
>     Versions: 0.9
>     Reporter: Martin Perez
>     Assignee: Jukka Zitting
>      Fix For: 1.0
>  Attachments: dbpm-jndi.patch
>
> Currently, DB persistence managers have hardcoded urls. Even more, they will use a single connection with the drawbacks that this have regarding concurrency, performance and transactionality. 
> It would be fairly better to allow to configure DB persistence managers through JDNI references to DataSource. So giving responsability to application server. Concurrency, performance and transactionability will be highly boosted with this approach. 
> This could be a sample configuration :
> <PersistenceManager class="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
>        <param name="dataSource" value="jdbc/JackrabbitDS"/>
>         
>        .... think also about a way to pass params to data source, it should be simple ....
>        <param name="schema" value="mysql"/>
>        <param name="schemaObjectPrefix" value="${
> wsp.name}_"/>
>        <param name="externalBLOBs" value="false"/>
>    </PersistenceManager>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira