OAK-1813 - LastRevSingleNodeRecoveryTest fails with Mongo

lastRevisionTimestamp was not getting reset when Revision clock was getting reset in test execution. This caused mismatch in timings. As a fix the  lastRevisionTimestamp would be set to clock time upon reset

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594158 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

Refactor access to previous doc to find previous doc with maxAge set to max value so as to enable reads of previous documents from secondaries

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594159 13f79535-47bb-0310-9956-ffa450edef68
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

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594160 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

The find and query method now explicitly define the read preference to be used. The preference is determined by type of Collection , maxCacheAge and modified time of parent. if preference is secondary then actual preference used is picked from DB level settings

Also exposed a setting 'maxReplicationLagMillis' which determines the max possible lag in replication beyond which its safe to route the read queries to secondaries

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594161 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

Instead of explicitly specifying the readPreference (as secondary) the preference value is picked from DB level setting allowing the user to fine tune the preferences via mongouri

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594162 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

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

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594163 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

Do not use the clock from builder for now as it causes other testcases to fail as some aspects of code still use System.currenttime.

Instead one can specify custom clock directly for testing purpose. This localizes clock change for testing

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594164 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

Fix logic related to determining the parentId when query is being performed as fromKey are not valid id in some cases

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594166 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

Integrate with changes done in OAK-759. The readWriteMode is now parsed as MongoUri option. The default value read is now read per collection. So if custom readWrite mode is specified then that value be used otherwise global DB level value would be used

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594167 13f79535-47bb-0310-9956-ffa450edef68
OAK-1645 - Route find queries to Mongo secondary in MongoDocumentStore

Log when call is routed to secondary

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1594169 13f79535-47bb-0310-9956-ffa450edef68