jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1492995 - /jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
Date Fri, 14 Jun 2013 08:22:54 GMT
Author: alexparvulescu
Date: Fri Jun 14 08:22:54 2013
New Revision: 1492995

URL: http://svn.apache.org/r1492995
Log:
OAK-763 Asynchronous indexing
 - added some progress logs for the lucene index 

Modified:
    jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java

Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java?rev=1492995&r1=1492994&r2=1492995&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
(original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
Fri Jun 14 08:22:54 2013
@@ -33,6 +33,7 @@ import static org.apache.lucene.store.No
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.concurrent.atomic.AtomicLong;
 
 import javax.jcr.PropertyType;
 
@@ -80,6 +81,8 @@ public class LuceneIndexEditor implement
 
     private static final Parser parser = new AutoDetectParser();
 
+    private AtomicLong indexedNodes;
+
     private static IndexWriterConfig getIndexWriterConfig() {
         // FIXME: Hack needed to make Lucene work in an OSGi environment
         Thread thread = Thread.currentThread();
@@ -157,6 +160,7 @@ public class LuceneIndexEditor implement
         } else {
             this.propertyTypes = -1;
         }
+        this.indexedNodes = new AtomicLong(0);
     }
 
     private LuceneIndexEditor(LuceneIndexEditor parent, String name) {
@@ -166,6 +170,7 @@ public class LuceneIndexEditor implement
         this.definition = parent.definition;
         this.writer = parent.writer;
         this.propertyTypes = parent.propertyTypes;
+        this.indexedNodes = parent.indexedNodes;
     }
 
     public String getPath() {
@@ -200,14 +205,22 @@ public class LuceneIndexEditor implement
                 throw new CommitFailedException(
                         "Lucene", 3, "Failed to index the node " + path, e);
             }
+            long indexed = indexedNodes.incrementAndGet();
+            if (indexed % 1000 == 0) {
+                log.debug("Indexed {} nodes...", indexed);
+            }
         }
 
         if (parent == null) {
             try {
                 writer.close();
             } catch (IOException e) {
-                throw new CommitFailedException(
-                        "Lucene", 4, "Failed to close the Lucene index", e);
+                throw new CommitFailedException("Lucene", 4,
+                        "Failed to close the Lucene index", e);
+            }
+            long indexed = indexedNodes.get();
+            if (indexed > 0) {
+                log.debug("Indexed {} nodes, done.", indexed);
             }
         }
     }



Mime
View raw message