Author: catholicon
Date: Mon Aug 22 08:50:33 2016
New Revision: 1757119
URL: http://svn.apache.org/viewvc?rev=1757119&view=rev
Log:
OAK-4623: Log more information when null DocumentNodeState is read for a child
while fetching children
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java?rev=1757119&r1=1757118&r2=1757119&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
Mon Aug 22 08:50:33 2016
@@ -1059,7 +1059,25 @@ public final class DocumentNodeStore
String p = concat(parent.getPath(), input);
DocumentNodeState result = getNode(p, readRevision);
if (result == null) {
- throw new DocumentStoreException("DocumentNodeState is
null for revision " + readRevision + " of " + p + " (aborting
getChildNodes())");
+ //This is very unexpected situation - parent's child list
declares the child to exist, while
+ //its node state is null. Let's put some extra effort to
do some logging
+ String id = Utils.getIdFromPath(p);
+ String cachedDocStr, uncachedDocStr;
+ try {
+ cachedDocStr = store.find(Collection.NODES,
id).asString();
+ } catch (DocumentStoreException dse) {
+ cachedDocStr = dse.toString();
+ }
+ try {
+ uncachedDocStr = store.find(Collection.NODES, id,
0).asString();
+ } catch (DocumentStoreException dse) {
+ uncachedDocStr = dse.toString();
+ }
+ String exceptionMsg = String.format(
+ "Aborting getChildNodes() - DocumentNodeState is
null for %s at %s " +
+ "{\"cachedDoc\":{%s},
\"uncachedDoc\":{%s}}",
+ readRevision, p, cachedDocStr, uncachedDocStr);
+ throw new DocumentStoreException(exceptionMsg);
}
return result;
}