jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1594163 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
Date Tue, 13 May 2014 09:17:50 GMT
Author: chetanm
Date: Tue May 13 09:17:50 2014
New Revision: 1594163

URL: http://svn.apache.org/r1594163
Log:
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

Expose the setting for 'maxReplicationLagInSecs' which defaults to 6 hours

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java?rev=1594163&r1=1594162&r2=1594163&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
Tue May 13 09:17:50 2014
@@ -25,7 +25,6 @@ import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.Hashtable;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
@@ -153,6 +152,9 @@ public class DocumentNodeStoreService {
     public static final String PROP_BLOB_GC_MAX_AGE = "blobGcMaxAgeInSecs";
     private long blobGcMaxAgeInSecs = DEFAULT_BLOB_GC_MAX_AGE;
 
+    private static final long DEFAULT_MAX_REPLICATION_LAG = TimeUnit.HOURS.toSeconds(6);
+    public static final String PROP_REPLICATION_LAG = "maxReplicationLagInSecs";
+    private long maxReplicationLagInSecs = DEFAULT_MAX_REPLICATION_LAG;
 
     @Activate
     protected void activate(ComponentContext context, Map<String, ?> config) throws
Exception {
@@ -160,6 +162,8 @@ public class DocumentNodeStoreService {
         this.whiteboard = new OsgiWhiteboard(context.getBundleContext());
         this.executor = new WhiteboardExecutor();
         executor.start(whiteboard);
+        this.maxReplicationLagInSecs = PropertiesUtil.toLong(config.get(PROP_REPLICATION_LAG),
+                DEFAULT_MAX_REPLICATION_LAG);
 
         if (blobStore == null &&
                 PropertiesUtil.toBoolean(prop(CUSTOM_BLOB_STORE), false)) {
@@ -234,14 +238,16 @@ public class DocumentNodeStoreService {
                 // Take care around not logging the uri directly as it
                 // might contain passwords
                 String type = useMK ? "MK" : "NodeStore";
-                log.info("Starting Document{} with host={}, db={}, cache size (MB)={}, Off
Heap Cache size (MB)={}, 'changes' collection size (MB)={}",
-                        type, mongoURI.getHosts(), db, cacheSize, offHeapCache, changesSize);
+                log.info("Starting Document{} with host={}, db={}, cache size (MB)={}, Off
Heap Cache size (MB)={}, " +
+                                "'changes' collection size (MB)={}, maxReplicationLagInSecs={}",
+                        type, mongoURI.getHosts(), db, cacheSize, offHeapCache, changesSize,
maxReplicationLagInSecs);
                 log.info("Mongo Connection details {}", MongoConnection.toString(mongoURI.getOptions()));
             }
 
             MongoClient client = new MongoClient(mongoURI);
             DB mongoDB = client.getDB(db);
 
+            mkBuilder.setMaxReplicationLag(maxReplicationLagInSecs, TimeUnit.SECONDS);
             mkBuilder.setMongoDB(mongoDB, changesSize);
 
             log.info("Connected to database {}", mongoDB);



Mime
View raw message