nfsantos commented on code in PR #1012:
URL: https://github.com/apache/jackrabbit-oak/pull/1012#discussion_r1247956697


##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/cursor/TraversingCursor.java:
##########
@@ -159,10 +159,15 @@ private void fetchNext() {
 
                 readCount++;
                 if (readCount % 1000 == 0) {
-                    FilterIterators.checkReadLimit(readCount, settings);
-                    String caller = 
IndexUtils.getCaller(this.settings.getIgnoredClassNamesInCallTrace());
-                    LOG.warn("Traversed {} nodes with filter {} called by {}; 
consider creating an index or changing the query" , 
-                            readCount, filter, caller);
+                    if (readCount == 20000) {
+                        LOG.warn("Traversed {} nodes with filter {}; consider 
creating an index or changing the query",
+                                readCount, filter, new Exception("call 
stack"));

Review Comment:
   Very minor suggestion: you could use Throwable instead of Exception, because 
it is the base class of the exception hierarchy (a matter of being 
minimalistic).



##########
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/spi/query/FulltextIndex.java:
##########
@@ -429,7 +429,12 @@ public String next() {
                     readCount++;
                     if (readCount % TRAVERSING_WARNING == 0) {
                         Cursors.checkReadLimit(readCount, settings);
-                        log.warn("Index-Traversed {} nodes with filter {}", 
readCount, plan.getFilter());
+                        if (readCount == 2 * TRAVERSING_WARNING) {

Review Comment:
   So this will print the stack trace the second time that the traverse warning 
message is displayed and then it will not print it again. If the idea is to 
print it only once, why not print it with the first message, so the first time 
the user is warned?



##########
oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndex.java:
##########
@@ -1180,7 +1180,12 @@ public String next() {
                     readCount++;
                     if (readCount % TRAVERSING_WARNING == 0) {
                         Cursors.checkReadLimit(readCount, settings);
-                        LOG.warn("Index-Traversed {} nodes with filter {}", 
readCount, filter);
+                        if (readCount == 2 * TRAVERSING_WARNING) {

Review Comment:
   Same comment as before, why not print it only on the first warning message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to