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 th...@apache.org on 2014/08/11 11:01:38 UTC

svn commit: r1617227 - /jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/query/FilterIterators.java

Author: thomasm
Date: Mon Aug 11 09:01:38 2014
New Revision: 1617227

URL: http://svn.apache.org/r1617227
Log:
OAK-2018 Query: before throwing "traversed more than x nodes" exception, log it

Modified:
    jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/query/FilterIterators.java

Modified: jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/query/FilterIterators.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/query/FilterIterators.java?rev=1617227&r1=1617226&r2=1617227&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/query/FilterIterators.java (original)
+++ jackrabbit/oak/branches/1.0/oak-core/src/main/java/org/apache/jackrabbit/oak/query/FilterIterators.java Mon Aug 11 09:01:38 2014
@@ -20,11 +20,16 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * Filtering iterators that are useful for queries with limit, offset, order by,
  * or distinct.
  */
 public class FilterIterators {
+    
+    private static final Logger LOG = LoggerFactory.getLogger(FilterIterators.class);    
 
     /**
      * Verify the number of in-memory nodes is below the limit.
@@ -35,10 +40,13 @@ public class FilterIterators {
      */
     public static void checkMemoryLimit(long count, long maxMemoryEntries) {
         if (count > maxMemoryEntries) {
-            throw new UnsupportedOperationException(
-                    "The query read more than " + 
-                            maxMemoryEntries + " nodes in memory. " + 
-                            "To avoid running out of memory, processing was stopped.");
+            String message = "The query read more than " + 
+                    maxMemoryEntries + " nodes in memory.";
+            UnsupportedOperationException e = new UnsupportedOperationException(
+                    message + 
+                    " To avoid running out of memory, processing was stopped.");
+            LOG.warn(message, e);
+            throw e;
         }
     }
     
@@ -50,10 +58,13 @@ public class FilterIterators {
      */
     public static void checkReadLimit(long count, long maxReadEntries) {
         if (count > maxReadEntries) {
-            throw new UnsupportedOperationException(
-                    "The query read or traversed more than " + 
-                            maxReadEntries + " nodes. " + 
-                            "To avoid affecting other tasks, processing was stopped.");
+            String message = "The query read or traversed more than " + 
+                    maxReadEntries + " nodes.";
+            UnsupportedOperationException e = new UnsupportedOperationException(
+                    message + 
+                    " To avoid affecting other tasks, processing was stopped.");
+            LOG.warn(message, e);
+            throw e;
         }
     }