You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Thomas Mueller (JIRA)" <ji...@apache.org> on 2016/11/17 09:57:58 UTC

[jira] [Commented] (OAK-2821) PersistentCache not used for RDBBlobStore

    [ https://issues.apache.org/jira/browse/OAK-2821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15673292#comment-15673292 ] 

Thomas Mueller commented on OAK-2821:
-------------------------------------

Proposed patch:

{noformat}
--- oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java	(revision 1770130)
+++ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java	(working copy)
@@ -636,15 +636,19 @@
 
             if (this.blobStore == null) {
                 GarbageCollectableBlobStore s = new MongoBlobStore(db, blobCacheSizeMB * 1024 * 1024L);
-                configureBlobStore(s);
-                PersistentCache p = getPersistentCache();
-                if (p != null) {
-                    s = p.wrapBlobStore(s);
-                }
-                this.blobStore = s;
+                setBlobStore(s);
             }
             return this;
         }
+        
+        private void setBlobStore(GarbageCollectableBlobStore s) {
+            configureBlobStore(s);
+            PersistentCache p = getPersistentCache();
+            if (p != null) {
+                s = p.wrapBlobStore(s);
+            }
+            this.blobStore = s;
+        }
 
         /**
          * Use the given MongoDB as backend storage for the DocumentNodeStore.
@@ -685,9 +689,9 @@
          */
         public Builder setRDBConnection(DataSource ds, RDBOptions options) {
             this.documentStore = new RDBDocumentStore(ds, this, options);
-            if(this.blobStore == null) {
-                this.blobStore = new RDBBlobStore(ds, options);
-                configureBlobStore(blobStore);
+            if(blobStore == null) {
+                GarbageCollectableBlobStore s = new RDBBlobStore(ds, options);
+                setBlobStore(s);
             }
             return this;
         }
@@ -700,8 +704,10 @@
          */
         public Builder setRDBConnection(DataSource documentStoreDataSource, DataSource blobStoreDataSource) {
             this.documentStore = new RDBDocumentStore(documentStoreDataSource, this);
-            this.blobStore = new RDBBlobStore(blobStoreDataSource);
-            configureBlobStore(blobStore);
+            if(blobStore == null) {
+                GarbageCollectableBlobStore s = new RDBBlobStore(blobStoreDataSource);
+                setBlobStore(s);
+            }            
             return this;
         }
{noformat}

> PersistentCache not used for RDBBlobStore
> -----------------------------------------
>
>                 Key: OAK-2821
>                 URL: https://issues.apache.org/jira/browse/OAK-2821
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: rdbmk
>    Affects Versions: 1.2.12, 1.0.28, 1.4.0
>            Reporter: Julian Reschke
>            Assignee: Thomas Mueller
>            Priority: Minor
>              Labels: candidate_oak_1_0, candidate_oak_1_2, candidate_oak_1_4
>             Fix For: 1.8
>
>         Attachments: OAK-2821.diff
>
>
> DocumentMK is currently inconsistent wrt to the use of the PersistentCache for BlobStore. It is used for Mongo, but not for RDB. We should be consistent here.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)