jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1594160 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo: CacheInvalidator.java MongoMissingLastRevSeeker.java
Date Tue, 13 May 2014 09:16:38 GMT
Author: chetanm
Date: Tue May 13 09:16:37 2014
New Revision: 1594160

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

Use explicit read preferences to ensure that reads are routed to primary irrespective of default
global settings

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/CacheInvalidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/CacheInvalidator.java?rev=1594160&r1=1594159&r2=1594160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/CacheInvalidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/CacheInvalidator.java
Tue May 13 09:16:37 2014
@@ -37,6 +37,7 @@ import com.mongodb.DBCursor;
 import com.mongodb.DBObject;
 import com.mongodb.QueryBuilder;
 
+import com.mongodb.ReadPreference;
 import org.apache.jackrabbit.oak.cache.CacheValue;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.document.CachedNodeDocument;
@@ -135,6 +136,7 @@ abstract class CacheInvalidator {
 
             // Fetch lastRev for each such node
             DBCursor cursor = nodes.find(query.get(), keys);
+            cursor.setReadPreference(ReadPreference.primary());
             result.queryCount++;
 
             for (DBObject obj : cursor) {
@@ -222,6 +224,7 @@ abstract class CacheInvalidator {
 
                         // Fetch lastRev and modCount for each such nodes
                         DBCursor cursor = nodes.find(query.get(), keys);
+                        cursor.setReadPreference(ReadPreference.primary());
                         LOG.debug(
                                 "Checking for changed nodes at level {} with {} paths",
                                 tn.level(), sameLevelNodes.size());

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java?rev=1594160&r1=1594159&r2=1594160&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoMissingLastRevSeeker.java
Tue May 13 09:16:37 2014
@@ -67,8 +67,7 @@ public class MongoMissingLastRevSeeker e
         DBCursor cursor =
                 getNodeCollection().find(query)
                         .sort(sortFields)
-                        .setReadPreference(
-                                ReadPreference.secondaryPreferred());
+                        .setReadPreference(ReadPreference.primary());
         return CloseableIterable.wrap(transform(cursor, new Function<DBObject, NodeDocument>()
{
             @Override
             public NodeDocument apply(DBObject input) {



Mime
View raw message