jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1594169 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
Date Tue, 13 May 2014 09:19:42 GMT
Author: chetanm
Date: Tue May 13 09:19:42 2014
New Revision: 1594169

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

Log when call is routed to secondary

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java?rev=1594169&r1=1594168&r2=1594169&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
Tue May 13 09:19:42 2014
@@ -321,6 +321,11 @@ public class MongoDocumentStore implemen
         long start = start();
         try {
             ReadPreference readPreference = getMongoReadPreference(collection, Utils.getParentId(key),
docReadPref);
+
+            if(readPreference.isSlaveOk()){
+                LOG.trace("Routing call to secondary for fetching [{}]", key);
+            }
+
             DBObject obj = dbCollection.findOne(getByKeyQuery(key).get(), null, null, readPreference);
 
             if (obj == null
@@ -378,7 +383,14 @@ public class MongoDocumentStore implemen
         try {
             DBCursor cursor = dbCollection.find(query).sort(BY_ID_ASC);
             String parentId = Utils.getParentIdFromLowerLimit(fromKey);
-            cursor.setReadPreference(getMongoReadPreference(collection, parentId, getDefaultReadPreference(collection)));
+            ReadPreference readPreference =
+                    getMongoReadPreference(collection, parentId, getDefaultReadPreference(collection));
+
+            if(readPreference.isSlaveOk()){
+                LOG.trace("Routing call to secondary for fetching children from [{}] to [{}]",
fromKey, toKey);
+            }
+
+            cursor.setReadPreference(readPreference);
 
             List<T> list;
             try {



Mime
View raw message