You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2016/06/20 11:35:16 UTC

svn commit: r1749306 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/plugins/document/ main/java/org/apache/jackrabbit/oak/plugins/document/mongo/ main/java/org/apache/jackrabbit/oak/plugins/document/mongo/replica/ main/jav...

Author: mreutegg
Date: Mon Jun 20 11:35:15 2016
New Revision: 1749306

URL: http://svn.apache.org/viewvc?rev=1749306&view=rev
Log:
OAK-3865: New strategy to optimize secondary reads

Revert change because of test failures (OAK-4486).

Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/replica/
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/replica/
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/ReadPreferenceIT.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1749306&r1=1749305&r2=1749306&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java Mon Jun 20 11:35:15 2016
@@ -499,7 +499,6 @@ public class DocumentMK {
         public static final int DEFAULT_CACHE_STACK_MOVE_DISTANCE = 16;
         private DocumentNodeStore nodeStore;
         private DocumentStore documentStore;
-        private String mongoUri;
         private DiffCache diffCache;
         private BlobStore blobStore;
         private int clusterId  = Integer.getInteger("oak.documentMK.clusterId", 0);
@@ -556,8 +555,6 @@ public class DocumentMK {
                                   @Nonnull String name,
                                   int blobCacheSizeMB)
                 throws UnknownHostException {
-            this.mongoUri = uri;
-
             DB db = new MongoConnection(uri).getDB(name);
             if (!MongoConnection.hasWriteConcern(uri)) {
                 db.setWriteConcern(MongoConnection.getDefaultWriteConcern(db));
@@ -605,16 +602,6 @@ public class DocumentMK {
         }
 
         /**
-         * Returns the Mongo URI used in the {@link #setMongoDB(String, String, int)} method.
-         *
-         * @return the Mongo URI or null if the {@link #setMongoDB(String, String, int)} method hasn't
-         * been called.
-         */
-        public String getMongoUri() {
-            return mongoUri;
-        }
-
-        /**
          * Sets a {@link DataSource} to use for the RDB document and blob
          * stores.
          *

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java?rev=1749306&r1=1749305&r2=1749306&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java Mon Jun 20 11:35:15 2016
@@ -1326,17 +1326,10 @@ public final class NodeDocument extends
     }
 
     NodeDocument getPreviousDocument(String prevId){
+        //Use the maxAge variant such that in case of Mongo call for
+        //previous doc are directed towards replicas first
         LOG.trace("get previous document {}", prevId);
-        NodeDocument doc = store.find(Collection.NODES, prevId);
-        if (doc == null) {
-            // In case secondary read preference is used and node is not found
-            // then check with primary again as it might happen that node document has not been
-            // replicated. We know that document with such an id must exist but possibly dut to
-            // replication lag it has not reached to secondary. So in that case read again
-            // from primary
-            doc = store.find(Collection.NODES, prevId, 0);
-        }
-        return doc;
+        return store.find(Collection.NODES, prevId, Integer.MAX_VALUE);
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java?rev=1749306&r1=1749305&r2=1749306&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoBlobStore.java Mon Jun 20 11:35:15 2016
@@ -23,8 +23,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.jackrabbit.oak.commons.StringUtils;
 import org.apache.jackrabbit.oak.plugins.blob.CachingBlobStore;
-import org.apache.jackrabbit.oak.plugins.document.Document;
-import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

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=1749306&r1=1749305&r2=1749306&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 Mon Jun 20 11:35:15 2016
@@ -61,7 +61,6 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.document.JournalEntry;
 import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
 import org.apache.jackrabbit.oak.plugins.document.Revision;
-import org.apache.jackrabbit.oak.plugins.document.RevisionVector;
 import org.apache.jackrabbit.oak.plugins.document.StableRevisionComparator;
 import org.apache.jackrabbit.oak.plugins.document.UpdateOp;
 import org.apache.jackrabbit.oak.plugins.document.UpdateOp.Condition;
@@ -71,8 +70,6 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.document.cache.CacheChangesTracker;
 import org.apache.jackrabbit.oak.plugins.document.cache.CacheInvalidationStats;
 import org.apache.jackrabbit.oak.plugins.document.cache.NodeDocumentCache;
-import org.apache.jackrabbit.oak.plugins.document.mongo.replica.LocalChanges;
-import org.apache.jackrabbit.oak.plugins.document.mongo.replica.ReplicaSetInfo;
 import org.apache.jackrabbit.oak.plugins.document.locks.NodeDocumentLocks;
 import org.apache.jackrabbit.oak.plugins.document.locks.StripedNodeDocumentLocks;
 import org.apache.jackrabbit.oak.plugins.document.util.Utils;
@@ -143,12 +140,6 @@ public class MongoDocumentStore implemen
 
     private Clock clock = Clock.SIMPLE;
 
-    private final ReplicaSetInfo replicaInfo;
-
-    private RevisionVector mostRecentAccessedRevisions;
-
-    private LocalChanges localChanges;
-
     private final long maxReplicationLagMillis;
 
     /**
@@ -180,24 +171,6 @@ public class MongoDocumentStore implemen
             Long.getLong("oak.mongo.maxQueryTimeMS", TimeUnit.MINUTES.toMillis(1));
 
     /**
-     * How often in milliseconds the MongoDocumentStore should estimate the
-     * replication lag.
-     * <p>
-     * Default is 60'000 (one minute).
-     */
-    private long estimationPullFrequencyMS =
-            Long.getLong("oak.mongo.estimationPullFrequencyMS", TimeUnit.SECONDS.toMillis(5));
-
-    /**
-     * Fallback to the old secondary-routing strategy. Setting this to true
-     * disables the optimisation introduced in the OAK-3865.
-     * <p>
-     * Default is false.
-     */
-    private boolean fallbackSecondaryStrategy =
-            Boolean.getBoolean("oak.mongo.fallbackSecondaryStrategy");
-
-    /**
      * The number of documents to put into one bulk update.
      * <p>
      * Default is 30.
@@ -238,18 +211,6 @@ public class MongoDocumentStore implemen
 
         maxReplicationLagMillis = builder.getMaxReplicationLagMillis();
 
-        if (fallbackSecondaryStrategy) {
-            replicaInfo = null;
-            localChanges = null;
-        } else {
-            replicaInfo = new ReplicaSetInfo(clock, db, builder.getMongoUri(), estimationPullFrequencyMS, maxReplicationLagMillis, builder.getExecutor());
-            Thread replicaInfoThread = new Thread(replicaInfo, "MongoDocumentStore replica set info provider (" + builder.getClusterId() + ")");
-            replicaInfoThread.setDaemon(true);
-            replicaInfoThread.start();
-            localChanges = new LocalChanges();
-            replicaInfo.addListener(localChanges);
-        }
-
         // indexes:
         // the _id field is the primary key, so we don't need to define it
 
@@ -510,7 +471,7 @@ public class MongoDocumentStore implemen
         boolean isSlaveOk = false;
         boolean docFound = true;
         try {
-            ReadPreference readPreference = getMongoReadPreference(collection, null, key, docReadPref);
+            ReadPreference readPreference = getMongoReadPreference(collection, Utils.getParentId(key), docReadPref);
 
             if(readPreference.isSlaveOk()){
                 LOG.trace("Routing call to secondary for fetching [{}]", key);
@@ -519,6 +480,17 @@ public class MongoDocumentStore implemen
 
             DBObject obj = dbCollection.findOne(getByKeyQuery(key).get(), null, null, readPreference);
 
+            if (obj == null
+                    && readPreference.isSlaveOk()) {
+                //In case secondary read preference is used and node is not found
+                //then check with primary again as it might happen that node document has not been
+                //replicated. This is required for case like SplitDocument where the SplitDoc is fetched with
+                //maxCacheAge == Integer.MAX_VALUE which results in readPreference of secondary.
+                //In such a case we know that document with such an id must exist
+                //but possibly dut to replication lag it has not reached to secondary. So in that case read again
+                //from primary
+                obj = dbCollection.findOne(getByKeyQuery(key).get(), null, null, ReadPreference.primary());
+            }
             if(obj == null){
                 docFound = false;
                 return null;
@@ -527,7 +499,6 @@ public class MongoDocumentStore implemen
             if (doc != null) {
                 doc.seal();
             }
-            updateLatestAccessedRevs(doc);
             return doc;
         } finally {
             stats.doneFindUncached(watch.elapsed(TimeUnit.NANOSECONDS), collection, key, docFound, isSlaveOk);
@@ -612,7 +583,7 @@ public class MongoDocumentStore implemen
                 cursor.maxTime(maxQueryTime, TimeUnit.MILLISECONDS);
             }
             ReadPreference readPreference =
-                    getMongoReadPreference(collection, parentId, null, getDefaultReadPreference(collection));
+                    getMongoReadPreference(collection, parentId, getDefaultReadPreference(collection));
 
             if(readPreference.isSlaveOk()){
                 isSlaveOk = true;
@@ -627,7 +598,6 @@ public class MongoDocumentStore implemen
                 for (int i = 0; i < limit && cursor.hasNext(); i++) {
                     DBObject o = cursor.next();
                     T doc = convertFromDBObject(collection, o);
-                    updateLatestAccessedRevs(doc);
                     list.add(doc);
                 }
                 resultSize = list.size();
@@ -800,7 +770,6 @@ public class MongoDocumentStore implemen
                 if (collection == Collection.NODES) {
                     NodeDocument newDoc = (NodeDocument) applyChanges(collection, oldDoc, updateOp);
                     nodesCache.put(newDoc);
-                    updateLocalChanges(newDoc);
                 }
                 oldDoc.seal();
             } else if (upsert) {
@@ -808,7 +777,6 @@ public class MongoDocumentStore implemen
                     NodeDocument doc = (NodeDocument) collection.newDocument(this);
                     UpdateUtils.applyChanges(doc, updateOp);
                     nodesCache.putIfAbsent(doc);
-                    updateLocalChanges(doc);
                 }
             } else {
                 // updateOp without conditions and not an upsert
@@ -971,11 +939,6 @@ public class MongoDocumentStore implemen
                         docsToCache.add(newDoc);
                     }
                 }
-
-                for (NodeDocument doc : docsToCache) {
-                    updateLocalChanges(doc);
-                }
-
                 nodesCache.putNonConflictingDocs(tracker, docsToCache);
             }
             oldDocs.keySet().removeAll(bulkResult.failedUpdates);
@@ -1141,7 +1104,6 @@ public class MongoDocumentStore implemen
                 if (collection == Collection.NODES) {
                     for (T doc : docs) {
                         nodesCache.putIfAbsent((NodeDocument) doc);
-                        updateLocalChanges((NodeDocument) doc);
                     }
                 }
                 insertSuccess = true;
@@ -1246,8 +1208,7 @@ public class MongoDocumentStore implemen
     }
 
     DocumentReadPreference getReadPreference(int maxCacheAge){
-        long lag = fallbackSecondaryStrategy ? maxReplicationLagMillis : replicaInfo.getLag();
-        if(maxCacheAge >= 0 && maxCacheAge < lag) {
+        if(maxCacheAge >= 0 && maxCacheAge < maxReplicationLagMillis) {
             return DocumentReadPreference.PRIMARY;
         } else if(maxCacheAge == Integer.MAX_VALUE){
             return DocumentReadPreference.PREFER_SECONDARY;
@@ -1260,10 +1221,9 @@ public class MongoDocumentStore implemen
         return col == Collection.NODES ? DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH : DocumentReadPreference.PRIMARY;
     }
 
-    <T extends Document> ReadPreference getMongoReadPreference(@Nonnull Collection<T> collection,
-                                                               @Nullable String parentId,
-                                                               @Nullable String documentId,
-                                                               @Nonnull DocumentReadPreference preference) {
+    <T extends Document> ReadPreference getMongoReadPreference(Collection<T> collection,
+                                                               String parentId,
+                                                               DocumentReadPreference preference) {
         switch(preference){
             case PRIMARY:
                 return ReadPreference.primary();
@@ -1276,37 +1236,23 @@ public class MongoDocumentStore implemen
                     return ReadPreference.primary();
                 }
 
-                boolean secondarySafe;
-                if (fallbackSecondaryStrategy) {
-                   // This is not quite accurate, because ancestors
+                // read from primary unless parent has not been modified
+                // within replication lag period
+                ReadPreference readPreference = ReadPreference.primary();
+                if (parentId != null) {
+                    long replicationSafeLimit = getTime() - maxReplicationLagMillis;
+                    NodeDocument cachedDoc = nodesCache.getIfPresent(parentId);
+                    // FIXME: this is not quite accurate, because ancestors
                     // are updated in a background thread (_lastRev). We
                     // will need to revise this for low maxReplicationLagMillis
                     // values
-                    long replicationSafeLimit = getTime() - maxReplicationLagMillis;
+                    if (cachedDoc != null && !cachedDoc.hasBeenModifiedSince(replicationSafeLimit)) {
 
-                    if (parentId == null) {
-                        secondarySafe = false;
-                    } else {
                         //If parent has been modified loooong time back then there children
                         //would also have not be modified. In that case we can read from secondary
-                        NodeDocument cachedDoc = nodesCache.getIfPresent(parentId);
-                        secondarySafe = cachedDoc != null && !cachedDoc.hasBeenModifiedSince(replicationSafeLimit);
+                        readPreference = getConfiguredReadPreference(collection);
                     }
-                } else {
-                    secondarySafe = true;
-                    secondarySafe &= collection == Collection.NODES;
-                    secondarySafe &= documentId == null || !localChanges.mayContain(documentId);
-                    secondarySafe &= parentId == null || !localChanges.mayContainChildrenOf(parentId);
-                    secondarySafe &= mostRecentAccessedRevisions == null || replicaInfo.isMoreRecentThan(mostRecentAccessedRevisions);
                 }
-
-                ReadPreference readPreference;
-                if (secondarySafe) {
-                    readPreference = getConfiguredReadPreference(collection);
-                } else {
-                    readPreference = ReadPreference.primary();
-                }
-
                 return readPreference;
             default:
                 throw new IllegalArgumentException("Unsupported usage " + preference);
@@ -1381,9 +1327,6 @@ public class MongoDocumentStore implemen
 
     @Override
     public void dispose() {
-        if (replicaInfo != null) {
-            replicaInfo.stop();
-        }
         nodes.getDB().getMongo().close();
         try {
             nodesCache.close();
@@ -1617,27 +1560,6 @@ public class MongoDocumentStore implemen
         return diff;
     }
 
-    private synchronized <T extends Document> void updateLatestAccessedRevs(T doc) {
-        if (doc instanceof NodeDocument) {
-            RevisionVector accessedRevs = new RevisionVector(((NodeDocument) doc).getLastRev().values());
-            RevisionVector previousValue = mostRecentAccessedRevisions;
-            if (mostRecentAccessedRevisions == null) {
-                mostRecentAccessedRevisions = accessedRevs;
-            } else {
-                mostRecentAccessedRevisions = mostRecentAccessedRevisions.pmax(accessedRevs);
-            }
-            if (LOG.isDebugEnabled() && !mostRecentAccessedRevisions.equals(previousValue)) {
-                LOG.debug("Most recent accessed revisions: {}", mostRecentAccessedRevisions);
-            }
-        }
-    }
-
-    private void updateLocalChanges(NodeDocument doc) {
-        if (localChanges != null) {
-            localChanges.add(doc.getId(), doc.getLastRev().values());
-        }
-    }
-
     private static class BulkUpdateResult {
 
         private final Set<String> failedUpdates;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java?rev=1749306&r1=1749305&r2=1749306&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java Mon Jun 20 11:35:15 2016
@@ -759,21 +759,6 @@ public class Utils {
     }
 
     /**
-     * Returns true if all the revisions in the {@code a} greater or equals
-     * to their counterparts in {@code b}. If {@code b} contains revisions
-     * for cluster nodes that are not present in {@code a}, return false.
-     *
-     * @param a
-     * @param b
-     * @return true if all the revisions in the {@code a} are at least
-     * as recent as their counterparts in the {@code b}
-     */
-    public static boolean isGreaterOrEquals(@Nonnull RevisionVector a,
-                                            @Nonnull RevisionVector b) {
-        return a.pmax(b).equals(a);
-    }
-
-    /**
      * Wraps the given iterable and aborts iteration over elements when the
      * predicate on an element evaluates to {@code false}.
      *

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/ReadPreferenceIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/ReadPreferenceIT.java?rev=1749306&r1=1749305&r2=1749306&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/ReadPreferenceIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/ReadPreferenceIT.java Mon Jun 20 11:35:15 2016
@@ -54,6 +54,7 @@ public class ReadPreferenceIT extends Ab
         replicationLag = TimeUnit.SECONDS.toMillis(10);
         mongoConnection = connectionFactory.getConnection();
         mk = new DocumentMK.Builder()
+                .setMaxReplicationLag(replicationLag, TimeUnit.MILLISECONDS)
                 .setMongoDB(mongoConnection.getDB())
                 .setClusterId(1)
                 .setLeaseCheck(false)
@@ -82,27 +83,27 @@ public class ReadPreferenceIT extends Ab
     @Test
     public void testMongoReadPreferencesDefault() throws Exception{
         assertEquals(ReadPreference.primary(),
-                mongoDS.getMongoReadPreference(NODES,"foo", null, DocumentReadPreference.PRIMARY));
+                mongoDS.getMongoReadPreference(NODES,"foo", DocumentReadPreference.PRIMARY));
 
         assertEquals(ReadPreference.primaryPreferred(),
-                mongoDS.getMongoReadPreference(NODES,"foo", null, DocumentReadPreference.PREFER_PRIMARY));
+                mongoDS.getMongoReadPreference(NODES,"foo", DocumentReadPreference.PREFER_PRIMARY));
 
         //By default Mongo read preference is primary
         assertEquals(ReadPreference.primary(),
-                mongoDS.getMongoReadPreference(NODES,"foo", null, DocumentReadPreference.PREFER_SECONDARY));
+                mongoDS.getMongoReadPreference(NODES,"foo", DocumentReadPreference.PREFER_SECONDARY));
 
         //Change the default and assert again
         mongoDS.getDBCollection(NODES).getDB().setReadPreference(ReadPreference.secondary());
         assertEquals(ReadPreference.secondary(),
-                mongoDS.getMongoReadPreference(NODES,"foo", null, DocumentReadPreference.PREFER_SECONDARY));
+                mongoDS.getMongoReadPreference(NODES,"foo", DocumentReadPreference.PREFER_SECONDARY));
 
         //for case where parent age cannot be determined the preference should be primary
         assertEquals(ReadPreference.primary(),
-                mongoDS.getMongoReadPreference(NODES,"foo", null, DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
+                mongoDS.getMongoReadPreference(NODES,"foo", DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
 
         //For collection other than NODES always primary
         assertEquals(ReadPreference.primary(),
-                mongoDS.getMongoReadPreference(SETTINGS,"foo", null, DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
+                mongoDS.getMongoReadPreference(SETTINGS,"foo", DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
 
     }
 
@@ -123,7 +124,7 @@ public class ReadPreferenceIT extends Ab
 
         //For modifiedTime < replicationLag primary must be used
         assertEquals(ReadPreference.primary(),
-                mongoDS.getMongoReadPreference(NODES,parentId, null, DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
+                mongoDS.getMongoReadPreference(NODES,parentId, DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
 
         //Going into future to make parent /x old enough
         clock.waitUntil(Revision.getCurrentTimestamp() + replicationLag);
@@ -131,7 +132,7 @@ public class ReadPreferenceIT extends Ab
 
         //For old modified nodes secondaries should be preferred
         assertEquals(testPref,
-                mongoDS.getMongoReadPreference(NODES, parentId, null, DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
+                mongoDS.getMongoReadPreference(NODES, parentId, DocumentReadPreference.PREFER_SECONDARY_IF_OLD_ENOUGH));
     }
 
     @Test