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 2017/11/07 09:38:45 UTC

svn commit: r1814471 - in /jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document: Configuration.java DocumentNodeStoreService.java

Author: mreutegg
Date: Tue Nov  7 09:38:45 2017
New Revision: 1814471

URL: http://svn.apache.org/viewvc?rev=1814471&view=rev
Log:
OAK-6908: Change RDB default scheduling on RDB

Modified:
    jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java
    jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java

Modified: jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java?rev=1814471&r1=1814470&r2=1814471&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java (original)
+++ jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java Tue Nov  7 09:38:45 2017
@@ -160,12 +160,14 @@ import static org.apache.jackrabbit.oak.
     @AttributeDefinition(
             name = "Version GC scheduler expression",
             description = "A cron expression that defines when the Version GC is scheduled. " +
-                    "If this configuration entry is left empty, the default value depends on " +
+                    "If this configuration entry is left empty, the default behaviour depends on " +
                     "the 'documentStoreType'. For 'MONGO' the default is to schedule a " +
                     "run every five seconds (also known as Continuous Revision Garbage " +
-                    "collection). For 'RDB' the default is to schedule a run once a day " +
-                    "starting at 2 AM. The corresponding cron expression is '" +
-                    DocumentNodeStoreService.CLASSIC_RGC_EXPR + "'.")
+                    "Collection). For 'RDB' the default is no scheduled GC. It must be " +
+                    "enabled explicitly with a cron expression. E.g. the following " +
+                    "expression triggers a GC run every night at 2 AM: '" +
+                    DocumentNodeStoreService.CLASSIC_RGC_EXPR + "'."
+    )
     String versionGCExpression() default "";
 
     @AttributeDefinition(

Modified: jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java?rev=1814471&r1=1814470&r2=1814471&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java (original)
+++ jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java Tue Nov  7 09:38:45 2017
@@ -560,12 +560,17 @@ public class DocumentNodeStoreService {
         if (DocumentStoreType.fromString(config.documentStoreType()) == DocumentStoreType.MONGO) {
             defaultExpr = CONTINUOUS_RGC_EXPR;
         } else {
-            defaultExpr = CLASSIC_RGC_EXPR;
+            defaultExpr = "";
+        }
+        String expr = PropertiesUtil.toString(prop(PROP_VER_GC_EXPRESSION), "");
+        if (expr.isEmpty()) {
+            expr = defaultExpr;
         }
-        String expr = PropertiesUtil.toString(prop(PROP_VER_GC_EXPRESSION), defaultExpr);
         // validate expression
         try {
-            new CronExpression(expr);
+            if (!expr.isEmpty()) {
+                new CronExpression(expr);
+            }
         } catch (ParseException e) {
             log.warn("Invalid cron expression, falling back to default '" + defaultExpr + "'", e);
             expr = defaultExpr;
@@ -874,6 +879,9 @@ public class DocumentNodeStoreService {
 
     private void registerVersionGCJob(final DocumentNodeStore nodeStore) {
         String expr = getVersionGCExpression();
+        if (expr.isEmpty()) {
+            return;
+        }
         Map<String, Object> props = jobPropertiesFor(RevisionGCJob.class);
         props.put("scheduler.expression", expr);
         long versionGcMaxAgeInSecs = toLong(prop(PROP_VER_GC_MAX_AGE), DEFAULT_VER_GC_MAX_AGE);