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 am...@apache.org on 2015/07/07 08:04:04 UTC
svn commit: r1689577 - in /jackrabbit/oak/trunk/oak-lucene/src:
main/java/org/apache/jackrabbit/oak/plugins/index/lucene/
test/java/org/apache/jackrabbit/oak/plugins/index/lucene/
Author: amitj
Date: Tue Jul 7 06:04:03 2015
New Revision: 1689577
URL: http://svn.apache.org/r1689577
Log:
OAK-3020: Async Update fails after IllegalArgumentException
Ignored and logged IllegalArgumentException and removed CommitFailedException from internal methods.
Modified:
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/Aggregate.java
jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexEditor.java
jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/AggregateTest.java
Modified: jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/Aggregate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/Aggregate.java?rev=1689577&r1=1689576&r2=1689577&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/Aggregate.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/Aggregate.java Tue Jul 7 06:04:03 2015
@@ -78,7 +78,7 @@ class Aggregate {
return includes;
}
- public void collectAggregates(NodeState root, ResultCollector collector) throws CommitFailedException {
+ public void collectAggregates(NodeState root, ResultCollector collector) {
if (nodeTypeName.equals(ConfigUtil.getPrimaryTypeName(root))) {
List<Matcher> matchers = createMatchers();
collectAggregates(root, matchers, collector);
@@ -112,7 +112,7 @@ class Aggregate {
}
private static void collectAggregates(NodeState nodeState, List<Matcher> matchers,
- ResultCollector collector) throws CommitFailedException {
+ ResultCollector collector) {
for (ChildNodeEntry cne : nodeState.getChildNodeEntries()) {
List<Matcher> nextSet = newArrayListWithCapacity(matchers.size());
for (Matcher m : matchers) {
@@ -190,13 +190,12 @@ class Aggregate {
}
public void collectResults(T rootInclude, String rootIncludePath,
- String nodePath, NodeState nodeState, ResultCollector results)
- throws CommitFailedException {
+ String nodePath, NodeState nodeState, ResultCollector results) {
collectResults(nodePath, nodeState, results);
}
public void collectResults(String nodePath, NodeState nodeState,
- ResultCollector results) throws CommitFailedException {
+ ResultCollector results) {
}
@@ -240,7 +239,7 @@ class Aggregate {
@Override
public void collectResults(NodeInclude rootInclude, String rootIncludePath, String nodePath,
- NodeState nodeState, ResultCollector results) throws CommitFailedException {
+ NodeState nodeState, ResultCollector results) {
//For supporting jcr:contains(jcr:content, 'foo')
if (rootInclude.relativeNode){
results.onResult(new NodeIncludeResult(nodePath, rootIncludePath, nodeState));
@@ -309,8 +308,7 @@ class Aggregate {
}
@Override
- public void collectResults(String nodePath, NodeState nodeState, ResultCollector results)
- throws CommitFailedException {
+ public void collectResults(String nodePath, NodeState nodeState, ResultCollector results) {
if (pattern != null) {
for (PropertyState ps : nodeState.getProperties()) {
if (pattern.matcher(ps.getName()).matches()) {
@@ -340,9 +338,9 @@ class Aggregate {
}
public static interface ResultCollector {
- void onResult(NodeIncludeResult result) throws CommitFailedException;
+ void onResult(NodeIncludeResult result);
- void onResult(PropertyIncludeResult result) throws CommitFailedException;
+ void onResult(PropertyIncludeResult result);
}
public static class NodeIncludeResult {
@@ -508,8 +506,7 @@ class Aggregate {
null, currentPath));
}
- public void collectResults(ResultCollector results)
- throws CommitFailedException {
+ public void collectResults(ResultCollector results) {
checkArgument(status == Status.MATCH_FOUND);
//If result being collected as part of reaggregation then take path
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=1689577&r1=1689576&r2=1689577&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 Tue Jul 7 06:04:03 2015
@@ -297,13 +297,12 @@ public class LuceneIndexEditor implement
throw new CommitFailedException("Lucene", 3,
"Failed to index the node " + path, e);
} catch (IllegalArgumentException ie) {
- throw new CommitFailedException("Lucene", 3,
- "Failed to index the node " + path, ie);
+ log.warn("Failed to index the node [{}]", path, ie);
}
return false;
}
- private Document makeDocument(String path, NodeState state, boolean isUpdate) throws CommitFailedException {
+ private Document makeDocument(String path, NodeState state, boolean isUpdate) {
if (!isIndexable()) {
return null;
}
@@ -386,7 +385,7 @@ public class LuceneIndexEditor implement
NodeState state,
PropertyState property,
String pname,
- PropertyDefinition pd) throws CommitFailedException {
+ PropertyDefinition pd) {
boolean includeTypeForFullText = indexingRule.includePropertyType(property.getType().tag());
if (Type.BINARY.tag() == property.getType().tag()
&& includeTypeForFullText) {
@@ -433,7 +432,7 @@ public class LuceneIndexEditor implement
return pname;
}
- private boolean addTypedFields(List<Field> fields, PropertyState property, String pname) throws CommitFailedException {
+ private boolean addTypedFields(List<Field> fields, PropertyState property, String pname) {
int tag = property.getType().tag();
boolean fieldAdded = false;
for (int i = 0; i < property.count(); i++) {
@@ -460,7 +459,7 @@ public class LuceneIndexEditor implement
private boolean addTypedOrderedFields(List<Field> fields,
PropertyState property,
String pname,
- PropertyDefinition pd) throws CommitFailedException {
+ PropertyDefinition pd) {
// Ignore and warn if property multi-valued as not supported
if (property.getType().isArray()) {
log.warn(
@@ -651,11 +650,11 @@ public class LuceneIndexEditor implement
}
private boolean indexAggregates(final String path, final List<Field> fields,
- final NodeState state) throws CommitFailedException {
+ final NodeState state) {
final AtomicBoolean dirtyFlag = new AtomicBoolean();
indexingRule.getAggregate().collectAggregates(state, new Aggregate.ResultCollector() {
@Override
- public void onResult(Aggregate.NodeIncludeResult result) throws CommitFailedException {
+ public void onResult(Aggregate.NodeIncludeResult result) {
boolean dirty = indexAggregatedNode(path, fields, result);
if (dirty) {
dirtyFlag.set(true);
@@ -663,7 +662,7 @@ public class LuceneIndexEditor implement
}
@Override
- public void onResult(Aggregate.PropertyIncludeResult result) throws CommitFailedException {
+ public void onResult(Aggregate.PropertyIncludeResult result) {
boolean dirty = false;
if (result.pd.ordered) {
dirty |= addTypedOrderedFields(fields, result.propertyState,
@@ -687,10 +686,8 @@ public class LuceneIndexEditor implement
* @param fields indexed fields
* @param result aggregate result
* @return true if a field was created for passed node result
- * @throws CommitFailedException
*/
- private boolean indexAggregatedNode(String path, List<Field> fields, Aggregate.NodeIncludeResult result)
- throws CommitFailedException {
+ private boolean indexAggregatedNode(String path, List<Field> fields, Aggregate.NodeIncludeResult result) {
//rule for node being aggregated might be null if such nodes
//are not indexed on there own. In such cases we rely in current
//rule for some checks
Modified: jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/AggregateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/AggregateTest.java?rev=1689577&r1=1689576&r2=1689577&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/AggregateTest.java (original)
+++ jackrabbit/oak/trunk/oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/AggregateTest.java Tue Jul 7 06:04:03 2015
@@ -386,12 +386,12 @@ public class AggregateTest {
final ListMultimap<String, NodeIncludeResult> nodeResults = ArrayListMultimap.create();
final Map<String, PropertyIncludeResult> propResults = newHashMap();
@Override
- public void onResult(NodeIncludeResult result) throws CommitFailedException{
+ public void onResult(NodeIncludeResult result) {
nodeResults.put(result.nodePath, result);
}
@Override
- public void onResult(PropertyIncludeResult result) throws CommitFailedException {
+ public void onResult(PropertyIncludeResult result) {
propResults.put(result.propertyPath, result);
}