Author: chetanm
Date: Wed Nov 20 13:20:51 2013
New Revision: 1543810

URL: http://svn.apache.org/r1543810
Log:
OAK-1204 - Analyze behaviour while running Oak cluster on Mongo

Improving the error reporting to aid in debugging such exceptions

Modified:
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
    
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java?rev=1543810&r1=1543809&r2=1543810&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeState.java
 Wed Nov 20 13:20:51 2013
@@ -169,6 +169,7 @@ public final class KernelNodeState exten
                         path, revision, 0, 0, MAX_CHILD_NODE_NAMES,
                         "{\"properties\":[\"*\",\":hash\",\":id\"]}");
 
+                checkNotNull(json,"No node found at path [%s] for revision 
[%s]",path,revision);
                 JsopReader reader = new JsopTokenizer(json);
                 reader.read('{');
                 properties = new LinkedHashMap<String, PropertyState>();

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java?rev=1543810&r1=1543809&r2=1543810&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/mongomk/MongoMK.java
 Wed Nov 20 13:20:51 2013
@@ -46,6 +46,8 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.mongomk.blob.MongoBlobStore;
 import org.apache.jackrabbit.oak.plugins.mongomk.util.Utils;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
  * A MicroKernel implementation that stores the data in a MongoDB.
  */
@@ -192,7 +194,9 @@ public class MongoMK implements MicroKer
 
         if (from == null || to == null) {
             // TODO implement correct behavior if the node does't/didn't exist
-            throw new MicroKernelException("Diff is only supported if the node 
exists in both cases");
+            String msg = String.format("Diff is only supported if the node 
exists in both cases. " +
+                    "Node [%s], fromRev [%s] -> %s, toRev [%s] -> 
%s",path,fromRev, from != null, toRev, to != null);
+            throw new MicroKernelException(msg);
         }
         JsopWriter w = new JsopStream();
         for (String p : from.getPropertyNames()) {
@@ -311,6 +315,8 @@ public class MongoMK implements MicroKer
                 // a change is detected if the node changed recently,
                 // even if the revisions are well in the past
                 // if this is a problem it would need to be changed
+                checkNotNull(n1, "Node at [%s] not found for fromRev [%s]", n, 
fromRev);
+                checkNotNull(n2, "Node at [%s] not found for toRev [%s]", n, 
toRev);
                 if (!n1.getId().equals(n2.getId())) {
                     w.tag('^').key(n).object().endObject().newline();
                 }


Reply via email to