Author: chetanm
Date: Wed Jul  8 15:12:21 2015
New Revision: 1689897

URL: http://svn.apache.org/r1689897
Log:
OAK-3069 - Provide option to eagerly copy the new index files in CopyOnRead

Merging 1689008, 1689004

Modified:
    jackrabbit/oak/branches/1.2/   (props changed)
    
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
    
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
    
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexTracker.java
    
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java

Propchange: jackrabbit/oak/branches/1.2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  8 15:12:21 2015
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672642,1672644,1672834-1672835,1673351,1673410,1673414-1673415,1673436,1673644,1673662-1673664,1673669,1673695,1673738,1673787,1673791,1674046,1674065,1674075,1674107,1674228,1674780,1674880,1675054-1675055,1675319,1675332,1675354,1675357,1675382,1675555,1675566,1675593,1676198,1676237,1676407,1676458,1676539,1676670,1676693,1676703,1676725,1677579,1677581,1677609,1677611,1677774,1677788,1677797,1677804,1677806,1677939,1677991,1678023,1678095-1678096,1678171,1678173,1678211,1678323,1678758,1678938,1678954,1679144,1679165,1679191,1679232,1679235,1679503,1679958,1679961,1680182,1680222,1680232,1680236,1680461,1680633,1680643,1680747,1680805-1680806,1680903,1681282,1681767,1681918,1682042,1682218,1682235,1682437,1682494,1682555,1682855,1682904,1683059,1683089,1683213,1683249,1683259,1683278,1683323,1683687,1683700,1684174-1684175,1684186,1684376,1684442,1684561,1684570,1684601,1684618,1684820,1684868,1685023,1685370,1685552,1685589
 
-1685590,1685840,1685964,1685977,1685989,1685999,1686023,1686032,1686097,1686162,1686229,1686234,1686253,1686414,1686780,1686854,1686857,1686971,1687053-1687055,1687175,1687198,1687220,1687239-1687240,1687301,1687441,1687553,1688089-1688090,1688172,1688179,1688349,1688421,1688436,1688453,1688616,1688622,1688636,1688817,1689003,1689577,1689581,1689623,1689810,1689828,1689833
+/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672642,1672644,1672834-1672835,1673351,1673410,1673414-1673415,1673436,1673644,1673662-1673664,1673669,1673695,1673738,1673787,1673791,1674046,1674065,1674075,1674107,1674228,1674780,1674880,1675054-1675055,1675319,1675332,1675354,1675357,1675382,1675555,1675566,1675593,1676198,1676237,1676407,1676458,1676539,1676670,1676693,1676703,1676725,1677579,1677581,1677609,1677611,1677774,1677788,1677797,1677804,1677806,1677939,1677991,1678023,1678095-1678096,1678171,1678173,1678211,1678323,1678758,1678938,1678954,1679144,1679165,1679191,1679232,1679235,1679503,1679958,1679961,1680182,1680222,1680232,1680236,1680461,1680633,1680643,1680747,1680805-1680806,1680903,1681282,1681767,1681918,1682042,1682218,1682235,1682437,1682494,1682555,1682855,1682904,1683059,1683089,1683213,1683249,1683259,1683278,1683323,1683687,1683700,1684174-1684175,1684186,1684376,1684442,1684561,1684570,1684601,1684618,1684820,1684868,1685023,1685370,1685552,1685589
 
-1685590,1685840,1685964,1685977,1685989,1685999,1686023,1686032,1686097,1686162,1686229,1686234,1686253,1686414,1686780,1686854,1686857,1686971,1687053-1687055,1687175,1687198,1687220,1687239-1687240,1687301,1687441,1687553,1688089-1688090,1688172,1688179,1688349,1688421,1688436,1688453,1688616,1688622,1688636,1688817,1689003-1689004,1689008,1689577,1689581,1689623,1689810,1689828,1689833
 /jackrabbit/trunk:1345480

Modified: 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java?rev=1689897&r1=1689896&r2=1689897&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexCopier.java
 Wed Jul  8 15:12:21 2015
@@ -386,6 +386,8 @@ public class IndexCopier implements Copy
                         invalidFileCount.incrementAndGet();
                     } else {
                         reference.markValid();
+                        log.trace("[{}] found local copy of file {}",
+                                indexPath, name);
                     }
                 }
                 success = true;
@@ -474,8 +476,9 @@ public class IndexCopier implements Copy
             filesToBeDeleted = new HashSet<String>(filesToBeDeleted);
             filesToBeDeleted.removeAll(failedToDelete);
             if(!filesToBeDeleted.isEmpty()) {
-                log.debug("Following files have been removed from Lucene " +
-                        "index directory [{}]", filesToBeDeleted);
+                log.debug(
+                        "[{}] Following files have been removed from Lucene 
index directory {}",
+                        indexPath, filesToBeDeleted);
             }
         }
 

Modified: 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java?rev=1689897&r1=1689896&r2=1689897&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
 Wed Jul  8 15:12:21 2015
@@ -1152,11 +1152,11 @@ class IndexDefinition implements Aggrega
     }
 
     private static String determineIndexName(NodeState defn, String indexPath) 
{
+        if (indexPath == null){
+            indexPath = defn.getString(LuceneIndexConstants.INDEX_PATH);
+        }
         String indexName = defn.getString(PROP_NAME);
         if (indexName ==  null){
-            if (indexPath == null){
-                indexPath = defn.getString(LuceneIndexConstants.INDEX_PATH);
-            }
             if (indexPath != null) {
                 return indexPath;
             }

Modified: 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexTracker.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexTracker.java?rev=1689897&r1=1689896&r2=1689897&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexTracker.java
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexTracker.java
 Wed Jul  8 15:12:21 2015
@@ -96,7 +96,7 @@ class IndexTracker {
                     try {
                         long start = PERF_LOGGER.start();
                         IndexNode index = IndexNode.open(path, root, after, 
cloner);
-                        PERF_LOGGER.end(start, -1, "Index found to be updated 
at [{}]. Reopening the IndexNode", path);
+                        PERF_LOGGER.end(start, -1, "[{}] Index found to be 
updated. Reopening the IndexNode", path);
                         updates.put(path, index); // index can be null
                     } catch (IOException e) {
                         log.error("Failed to open Lucene index at " + path, e);

Modified: 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java?rev=1689897&r1=1689896&r2=1689897&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
 Wed Jul  8 15:12:21 2015
@@ -193,7 +193,7 @@ public class LuceneIndexEditor implement
             if (addOrUpdate(path, after, before.exists())) {
                 long indexed = context.incIndexedNodes();
                 if (indexed % 1000 == 0) {
-                    log.debug("{} => Indexed {} nodes...", 
context.getDefinition().getIndexName(), indexed);
+                    log.debug("[{}] => Indexed {} nodes...", getIndexName(), 
indexed);
                 }
             }
         }
@@ -210,7 +210,7 @@ public class LuceneIndexEditor implement
                         "Failed to close the Lucene index", e);
             }
             if (context.getIndexedNodes() > 0) {
-                log.debug("{} => Indexed {} nodes, done.", 
context.getDefinition().getIndexName(), context.getIndexedNodes());
+                log.debug("[{}] => Indexed {} nodes, done.", getIndexName(), 
context.getIndexedNodes());
             }
         }
     }
@@ -290,8 +290,8 @@ public class LuceneIndexEditor implement
         try {
             Document d = makeDocument(path, state, isUpdate);
             if (d != null) {
-                if (log.isTraceEnabled()){
-                    log.trace("Indexed document for {} is {}", path, d);
+                if (log.isTraceEnabled()) {
+                    log.trace("[{}] Indexed document for {} is {}", 
getIndexName(), path, d);
                 }
                 context.indexUpdate();
                 context.getWriter().updateDocument(newPathTerm(path), d);
@@ -472,8 +472,9 @@ public class LuceneIndexEditor implement
         // Ignore and warn if property multi-valued as not supported
         if (property.getType().isArray()) {
             log.warn(
-                "Ignoring ordered property {} of type {} for path {} as 
multivalued ordered property not supported",
-                pname, Type.fromTag(property.getType().tag(), true), 
getPath());
+                    "[{}] Ignoring ordered property {} of type {} for path {} 
as multivalued ordered property not supported",
+                    getIndexName(), pname,
+                    Type.fromTag(property.getType().tag(), true), getPath());
             return false;
         }
 
@@ -482,10 +483,11 @@ public class LuceneIndexEditor implement
         // Try converting type to the defined type in the index definition
         if (tag != idxDefinedTag) {
             log.debug(
-                "Ordered property defined with type {} differs from property 
{} with type {} in " +
-                    "path {}",
-                Type.fromTag(idxDefinedTag, false), property.toString(), 
Type.fromTag(tag, false),
-                getPath());
+                    "[{}] Ordered property defined with type {} differs from 
property {} with type {} in "
+                            + "path {}",
+                    getIndexName(),
+                    Type.fromTag(idxDefinedTag, false), property.toString(),
+                    Type.fromTag(tag, false), getPath());
             tag = idxDefinedTag;
         }
 
@@ -516,10 +518,10 @@ public class LuceneIndexEditor implement
             }
         } catch (Exception e) {
             log.warn(
-                "Ignoring ordered property. Could not convert property {} of 
type {} to type " +
-                    "{} for path {}",
-                pname, Type.fromTag(property.getType().tag(), false),
-                Type.fromTag(tag, false), getPath(), e);
+                    "[{}] Ignoring ordered property. Could not convert 
property {} of type {} to type {} for path {}",
+                    getIndexName(), pname,
+                    Type.fromTag(property.getType().tag(), false),
+                    Type.fromTag(tag, false), getPath(), e);
         }
         return fieldAdded;
     }
@@ -536,9 +538,10 @@ public class LuceneIndexEditor implement
         //jcr:mimeType is mandatory for a binary to be indexed
         String type = state.getString(JcrConstants.JCR_MIMETYPE);
 
-        if (type == null || !isSupportedMediaType(type)){
-            log.trace("Ignoring binary content for node {} due to unsupported 
" +
-                    "(or null) jcr:mimeType [{}]", nodePath, type);
+        if (type == null || !isSupportedMediaType(type)) {
+            log.trace(
+                    "[{}] Ignoring binary content for node {} due to 
unsupported (or null) jcr:mimeType [{}]",
+                    getIndexName(), nodePath, type);
             return fields;
         }
 
@@ -850,11 +853,12 @@ public class LuceneIndexEditor implement
             // Capture and report any other full text extraction problems.
             // The special STOP exception is used for normal termination.
             if (!handler.isWriteLimitReached(t)) {
-                log.debug("Failed to extract text from a binary property: "
-                        + path
+                log.debug(
+                        "[{}] Failed to extract text from a binary property: 
{}."
                         + " This is a fairly common case, and nothing to"
                         + " worry about. The stack trace is included to"
-                        + " help improve the text extraction feature.", t);
+                        + " help improve the text extraction feature.",
+                        getIndexName(), path, t);
                 return "TextExtractionError";
             }
         }
@@ -863,4 +867,8 @@ public class LuceneIndexEditor implement
         return result;
     }
 
+    private String getIndexName() {
+        return context.getDefinition().getIndexName();
+    }
+
 }


Reply via email to