Author: chetanm
Date: Fri Jul 3 12:02:51 2015
New Revision: 1689004
URL: http://svn.apache.org/r1689004
Log:
OAK-3068 - Lucene IndexCopier improved logs around the CopyOnRead feature
Applying patch from Alex
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
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/IndexDefinition.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java?rev=1689004&r1=1689003&r2=1689004&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
(original)
+++
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/IndexDefinition.java
Fri Jul 3 12:02:51 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/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=1689004&r1=1689003&r2=1689004&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 Jul 3 12:02:51 2015
@@ -191,7 +191,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);
}
}
}
@@ -208,7 +208,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());
}
}
}
@@ -286,8 +286,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);
@@ -464,8 +464,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;
}
@@ -474,10 +475,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;
}
@@ -508,10 +510,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;
}
@@ -528,9 +530,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;
}
@@ -829,11 +832,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";
}
}
@@ -842,4 +846,8 @@ public class LuceneIndexEditor implement
return result;
}
+ private String getIndexName() {
+ return context.getDefinition().getIndexName();
+ }
+
}