Author: reschke
Date: Thu May 16 05:41:07 2019
New Revision: 1859347

URL: http://svn.apache.org/viewvc?rev=1859347&view=rev
Log:
OAK-8311: RDBDocumentStore: allow to turn off RDB-specific MissingLastRevSeeker 
(with default 'off') (ported to 1.10)

Modified:
    jackrabbit/oak/branches/1.10/   (props changed)
    
jackrabbit/oak/branches/1.10/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java

Propchange: jackrabbit/oak/branches/1.10/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 16 05:41:07 2019
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1850874,1850882,1851236,1851253,1851451,1851533-1851535,1851619,1852052,1852084,1852120,1852135,1852451,1852492-1852493,1852528,1852582,1852584,1852601,1852920,1853083,1853141,1853229,1853393,1853429,1853433,1853441,1853866,1853868,1853870,1853893,1853969,1853997,1854034,1854044,1854055,1854058,1854113,1854373,1854377,1854380,1854385,1854401,1854403,1854455,1854461-1854462,1854466,1854468,1854515,1854533,1854539,1854701,1854773-1854774,1854827,1854848,1854859,1854930,1854990-1854991,1855032,1855221,1855477-1855478,1855776,1855993,1856049,1856056,1856538,1856545,1857000,1857010,1857104,1857159,1857212,1857221,1857238,1857247,1857253,1857294,1857314,1857577,1857635,1857638,1857640,1857687,1857936,1858032,1858053,1858123,1858139,1858571,1858578,1858810,1858931
+/jackrabbit/oak/trunk:1850874,1850882,1851236,1851253,1851451,1851533-1851535,1851619,1852052,1852084,1852120,1852135,1852451,1852492-1852493,1852528,1852582,1852584,1852601,1852920,1853083,1853141,1853229,1853393,1853429,1853433,1853441,1853866,1853868,1853870,1853893,1853969,1853997,1854034,1854044,1854055,1854058,1854113,1854373,1854377,1854380,1854385,1854401,1854403,1854455,1854461-1854462,1854466,1854468,1854515,1854533,1854539,1854701,1854773-1854774,1854827,1854848,1854859,1854930,1854990-1854991,1855032,1855221,1855477-1855478,1855776,1855993,1856049,1856056,1856538,1856545,1857000,1857010,1857104,1857159,1857212,1857221,1857238,1857247,1857253,1857294,1857314,1857577,1857635,1857638,1857640,1857687,1857936,1858032,1858053,1858123,1858139,1858571,1858578,1858810,1858931,1859231
 /jackrabbit/trunk:1345480

Modified: 
jackrabbit/oak/branches/1.10/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.10/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java?rev=1859347&r1=1859346&r2=1859347&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.10/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java
 (original)
+++ 
jackrabbit/oak/branches/1.10/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBMissingLastRevSeeker.java
 Thu May 16 05:41:07 2019
@@ -26,14 +26,49 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.document.MissingLastRevSeeker;
 import org.apache.jackrabbit.oak.plugins.document.NodeDocument;
 import 
org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.QueryCondition;
-import org.apache.jackrabbit.oak.plugins.document.util.CloseableIterable;
 import org.apache.jackrabbit.oak.stats.Clock;
 import org.jetbrains.annotations.NotNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * RDB specific version of MissingLastRevSeeker.
  */
 public class RDBMissingLastRevSeeker extends MissingLastRevSeeker {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(RDBMissingLastRevSeeker.class);
+
+    // 1: seek using historical, paging mode
+    // 2: use custom single query directly using RDBDocumentStore API
+    private static final int MODE;
+
+    private static final int DEFAULTMODE = 1;
+
+    static {
+        String propName = 
"org.apache.jackrabbit.oak.plugins.document.rdb.RDBMissingLastRevSeeker.MODE";
+        String value = System.getProperty(propName, "");
+        switch (value) {
+            case "":
+                MODE = DEFAULTMODE;
+                break;
+            case "1":
+                MODE = 1;
+                break;
+            case "2":
+                MODE = 2;
+                break;
+            default:
+                LOG.error("Ignoring unexpected value '" + value + "' for 
system property " + propName);
+                MODE = DEFAULTMODE;
+                break;
+        }
+
+        if (DEFAULTMODE != MODE) {
+            LOG.info("Strategy for " + RDBMissingLastRevSeeker.class.getName() 
+ " set to " + MODE + " (via system property "
+                    + propName + ")");
+        }
+    }
+
     private final RDBDocumentStore store;
 
     public RDBMissingLastRevSeeker(RDBDocumentStore store, Clock clock) {
@@ -44,9 +79,14 @@ public class RDBMissingLastRevSeeker ext
     @Override
     @NotNull
     public Iterable<NodeDocument> getCandidates(final long startTime) {
-        List<QueryCondition> conditions = Collections
-                .singletonList(new 
QueryCondition(NodeDocument.MODIFIED_IN_SECS, ">=", 
NodeDocument.getModifiedInSecs(startTime)));
-        return store.queryAsIterable(Collection.NODES, null, null, 
RDBDocumentStore.EMPTY_KEY_PATTERN, conditions,
-                Integer.MAX_VALUE, null);
+        LOG.debug("Running getCandidates() in mode " + MODE);
+        if (MODE == 1) {
+            return super.getCandidates(startTime);
+        } else {
+            List<QueryCondition> conditions = Collections.singletonList(
+                    new QueryCondition(NodeDocument.MODIFIED_IN_SECS, ">=", 
NodeDocument.getModifiedInSecs(startTime)));
+            return store.queryAsIterable(Collection.NODES, null, null, 
RDBDocumentStore.EMPTY_KEY_PATTERN, conditions,
+                    Integer.MAX_VALUE, null);
+        }
     }
 }


Reply via email to