jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1593041 - in /jackrabbit/oak/branches/1.0: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/ oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/ oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/
Date Wed, 07 May 2014 15:32:03 GMT
Author: mduerig
Date: Wed May  7 15:32:02 2014
New Revision: 1593041

URL: http://svn.apache.org/r1593041
Log:
OAK-1802: increase verbosity on migration progress
merged revision 1593036

Added:
    jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/AsciiArtTicker.java
      - copied unchanged from r1593036, jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/AsciiArtTicker.java
    jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/ProgressNotificationEditor.java
      - copied unchanged from r1593036, jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/ProgressNotificationEditor.java
    jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/ProgressTicker.java
      - copied unchanged from r1593036, jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/ProgressTicker.java
    jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/SimpleTicker.java
      - copied unchanged from r1593036, jackrabbit/oak/trunk/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/SimpleTicker.java
    jackrabbit/oak/branches/1.0/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/TickerTest.java
      - copied unchanged from r1593036, jackrabbit/oak/trunk/oak-upgrade/src/test/java/org/apache/jackrabbit/oak/upgrade/TickerTest.java
Modified:
    jackrabbit/oak/branches/1.0/   (props changed)
    jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
    jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java

Propchange: jackrabbit/oak/branches/1.0/
------------------------------------------------------------------------------
  Merged /jackrabbit/oak/trunk:r1593036

Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java?rev=1593041&r1=1593040&r2=1593041&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
(original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java
Wed May  7 15:32:02 2014
@@ -47,7 +47,7 @@ import org.apache.jackrabbit.oak.spi.sta
 
 import com.google.common.base.Objects;
 
-class IndexUpdate implements Editor {
+public class IndexUpdate implements Editor {
 
     private final IndexEditorProvider provider;
 
@@ -81,7 +81,7 @@ class IndexUpdate implements Editor {
      */
     private final IndexUpdateCallback updateCallback;
 
-    IndexUpdate(
+    public IndexUpdate(
             IndexEditorProvider provider, String async,
             NodeState root, NodeBuilder builder,
             IndexUpdateCallback updateCallback) {

Modified: jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java?rev=1593041&r1=1593040&r2=1593041&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
(original)
+++ jackrabbit/oak/branches/1.0/oak-upgrade/src/main/java/org/apache/jackrabbit/oak/upgrade/RepositoryUpgrade.java
Wed May  7 15:32:02 2014
@@ -94,7 +94,6 @@ import com.google.common.base.Charsets;
 import com.google.common.collect.HashBiMap;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Lists;
-
 import org.apache.jackrabbit.core.RepositoryContext;
 import org.apache.jackrabbit.core.config.BeanConfig;
 import org.apache.jackrabbit.core.config.LoginModuleConfig;
@@ -106,12 +105,15 @@ import org.apache.jackrabbit.core.nodety
 import org.apache.jackrabbit.core.persistence.PersistenceManager;
 import org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry;
 import org.apache.jackrabbit.core.security.user.UserManagerImpl;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.namepath.GlobalNameMapper;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider;
-import org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.IndexUpdate;
+import org.apache.jackrabbit.oak.plugins.index.IndexUpdateCallback;
 import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
 import org.apache.jackrabbit.oak.plugins.index.reference.ReferenceEditorProvider;
 import org.apache.jackrabbit.oak.plugins.name.NamespaceConstants;
@@ -124,7 +126,9 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.commit.CompositeEditorProvider;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
+import org.apache.jackrabbit.oak.spi.commit.Editor;
 import org.apache.jackrabbit.oak.spi.commit.EditorHook;
+import org.apache.jackrabbit.oak.spi.commit.EditorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
@@ -293,10 +297,9 @@ public class RepositoryUpgrade {
 
             // type validation, reference and indexing hooks
             hooks.add(new EditorHook(new CompositeEditorProvider(
-                            new TypeEditorProvider(false),
-                            new IndexUpdateProvider(new CompositeIndexEditorProvider(
-                                    new ReferenceEditorProvider(),
-                                    new PropertyIndexEditorProvider())))));
+                createTypeEditorProvider(),
+                createIndexEditorProvider()
+            )));
 
             target.merge(builder, CompositeHook.compose(hooks), CommitInfo.EMPTY);
         } catch (Exception e) {
@@ -304,6 +307,43 @@ public class RepositoryUpgrade {
         }
     }
 
+    private static EditorProvider createTypeEditorProvider() {
+        return new EditorProvider() {
+            @Override
+            public Editor getRootEditor(NodeState before, NodeState after, NodeBuilder builder,
CommitInfo info)
+                    throws CommitFailedException {
+                Editor rootEditor = new TypeEditorProvider(false)
+                        .getRootEditor(before, after, builder, info);
+                return ProgressNotificationEditor.wrap(rootEditor, logger, "Checking node
types:");
+            }
+        };
+    }
+
+    private static EditorProvider createIndexEditorProvider() {
+        final ProgressTicker ticker = new AsciiArtTicker();
+        return new EditorProvider() {
+            @Override
+            public Editor getRootEditor(NodeState before, NodeState after, NodeBuilder builder,
CommitInfo info) {
+                IndexEditorProvider editorProviders = new CompositeIndexEditorProvider(
+                        new ReferenceEditorProvider(),
+                        new PropertyIndexEditorProvider());
+
+                return new IndexUpdate(editorProviders, null, after, builder, new IndexUpdateCallback()
{
+                    String progress = "Updating indexes ";
+                    long t0;
+                    @Override
+                    public void indexUpdate() {
+                        long t = System.currentTimeMillis();
+                        if (t - t0 > 2000) {
+                            logger.info("{} {}", progress, ticker.tick());
+                            t0 = t ;
+                        }
+                    }
+                });
+            }
+        };
+    }
+
     protected ConfigurationParameters mapSecurityConfig(SecurityConfig config) {
         ConfigurationParameters loginConfig = mapConfigurationParameters(
                 config.getLoginModuleConfig(),



Mime
View raw message