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 re...@apache.org on 2017/03/09 13:49:15 UTC

svn commit: r1786171 - in /jackrabbit/oak/branches/1.6: ./ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java

Author: reschke
Date: Thu Mar  9 13:49:15 2017
New Revision: 1786171

URL: http://svn.apache.org/viewvc?rev=1786171&view=rev
Log:
OAK-5627: RDBDocumentStore: improve long query logging (ported to 1.6)

Modified:
    jackrabbit/oak/branches/1.6/   (props changed)
    jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java

Propchange: jackrabbit/oak/branches/1.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar  9 13:49:15 2017
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782770,1782945,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783619,1783731,1783733,1783742,1783855,1783891,1784023,1784130,1784162,1784251,1784401,1784551,1784574,1785095,1785108,1785283,1785838,1785919
+/jackrabbit/oak/trunk:1781068,1781075,1781248,1781386,1781846,1781907,1782000,1782029,1782196,1782447,1782476,1782770,1782945,1782973,1782990,1783061,1783066,1783089,1783104-1783105,1783619,1783731,1783733,1783742,1783855,1783891,1784023,1784130,1784162,1784251,1784401,1784551,1784574,1785095,1785108,1785283,1785838,1785919
 /jackrabbit/trunk:1345480

Modified: jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java?rev=1786171&r1=1786170&r2=1786171&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java (original)
+++ jackrabbit/oak/branches/1.6/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStoreJDBC.java Thu Mar  9 13:49:15 2017
@@ -524,18 +524,35 @@ public class RDBDocumentStoreJDBC {
         }
 
         long elapsed = System.currentTimeMillis() - start;
-        if (this.queryHitsLimit != 0 && result.size() > this.queryHitsLimit) {
-            String message = String.format(
-                    "Potentially excessive query on %s with %d hits (limited to %d, configured QUERYHITSLIMIT %d), elapsed time %dms, params minid '%s' maxid '%s' excludeKeyPatterns %s condition %s limit %d. Read %d chars from DATA and %d bytes from BDATA. Check calling method.",
-                    tmd.getName(), result.size(), limit, this.queryHitsLimit, elapsed, minId, maxId, excludeKeyPatterns, conditions,
-                    limit, dataTotal, bdataTotal);
-            LOG.info(message, new Exception("call stack"));
-        } else if (this.queryTimeLimit != 0 && elapsed > this.queryTimeLimit) {
-            String message = String.format(
-                    "Long running query on %s with %d hits (limited to %d), elapsed time %dms (configured QUERYTIMELIMIT %d), params minid '%s' maxid '%s' excludeKeyPatterns %s conditions %s limit %d. Read %d chars from DATA and %d bytes from BDATA. Check calling method.",
-                    tmd.getName(), result.size(), limit, elapsed, this.queryTimeLimit, minId, maxId, excludeKeyPatterns, conditions,
-                    limit, dataTotal, bdataTotal);
-            LOG.info(message, new Exception("call stack"));
+
+        if ((this.queryHitsLimit != 0 && result.size() > this.queryHitsLimit)
+                || (this.queryTimeLimit != 0 && elapsed > this.queryTimeLimit)) {
+
+            String params = String.format("params minid '%s' maxid '%s' excludeKeyPatterns %s conditions %s limit %d.", minId,
+                    maxId, excludeKeyPatterns, conditions, limit);
+
+            String resultRange = "";
+            if (result.size() > 0) {
+                resultRange = String.format(" Result range: '%s'...'%s'.", result.get(0).getId(),
+                        result.get(result.size() - 1).getId());
+            }
+
+            String postfix = String.format(" Read %d chars from DATA and %d bytes from BDATA. Check calling method.", dataTotal,
+                    bdataTotal);
+
+            if (this.queryHitsLimit != 0 && result.size() > this.queryHitsLimit) {
+                String message = String.format(
+                        "Potentially excessive query on %s with %d hits (limited to %d, configured QUERYHITSLIMIT %d), elapsed time %dms, %s%s%s",
+                        tmd.getName(), result.size(), limit, this.queryHitsLimit, elapsed, params, resultRange, postfix);
+                LOG.info(message, new Exception("call stack"));
+            }
+
+            if (this.queryTimeLimit != 0 && elapsed > this.queryTimeLimit) {
+                String message = String.format(
+                        "Long running query on %s with %d hits (limited to %d), elapsed time %dms (configured QUERYTIMELIMIT %d), %s%s%s",
+                        tmd.getName(), result.size(), limit, elapsed, this.queryTimeLimit, params, resultRange, postfix);
+                LOG.info(message, new Exception("call stack"));
+            }
         }
 
         return result;