jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1507970 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk: Commit.java Revision.java
Date Mon, 29 Jul 2013 08:33:15 GMT
Author: thomasm
Date: Mon Jul 29 08:33:14 2013
New Revision: 1507970

URL: http://svn.apache.org/r1507970
Log:
OAK-926 MongoMK: split documents when they are too large (temporary solution)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Revision.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java?rev=1507970&r1=1507969&r2=1507970&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Commit.java
Mon Jul 29 08:33:14 2013
@@ -45,8 +45,8 @@ public class Commit {
      */
     // TODO check which value is the best one
     //private static final int MAX_DOCUMENT_SIZE = 16 * 1024;
-    // TODO disabled until document split is fully implemented
-    private static final int MAX_DOCUMENT_SIZE = Integer.MAX_VALUE;
+    // TODO set to 512 KB currently, should be changed later on
+    private static final int MAX_DOCUMENT_SIZE = 512 * 1024;
 
     /**
      * Whether to purge old revisions if a node gets too large. If false, old
@@ -55,6 +55,12 @@ public class Commit {
      */
     private static final boolean PURGE_OLD_REVISIONS = true;
     
+    /**
+     * Revisions that are newer than this (in minutes) are kept in the newest
+     * document.
+     */
+    private static final int SPLIT_MINUTES = 5;
+    
     private final MongoMK mk;
     private final Revision baseRevision;
     private final Revision revision;
@@ -454,7 +460,13 @@ public class Commit {
                     if (propRev.equals(latestRev)) {
                         main.setMap(key, propRev.toString(), v);
                     } else {
-                        old.setMapEntry(key, propRev.toString(), v);
+                        long ageMillis = Revision.getCurrentTimestamp() - propRev.getTimestamp();
+                        long ageMinutes = ageMillis / 1000 / 60;
+                        if (ageMinutes > SPLIT_MINUTES) {
+                            old.setMapEntry(key, propRev.toString(), v);
+                        } else {
+                            main.setMap(key, propRev.toString(), v);
+                        }
                     }
                 }
             }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Revision.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Revision.java?rev=1507970&r1=1507969&r2=1507970&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Revision.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/Revision.java
Mon Jul 29 08:33:14 2013
@@ -163,6 +163,11 @@ public class Revision {
         return string;
     }
     
+    /**
+     * Get the timestamp in milliseconds since 1970.
+     * 
+     * @return the timestamp
+     */
     public long getTimestamp() {
         return timestamp;
     }



Mime
View raw message