You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pr...@apache.org on 2015/03/24 00:07:59 UTC

svn commit: r1668758 - /hive/branches/llap/llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelCacheImpl.java

Author: prasanthj
Date: Mon Mar 23 23:07:59 2015
New Revision: 1668758

URL: http://svn.apache.org/r1668758
Log:
HIVE-10064: LLAP: Cache hit rate could be wrong in some cases (Prasanth Jayachandran)

Modified:
    hive/branches/llap/llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelCacheImpl.java

Modified: hive/branches/llap/llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelCacheImpl.java
URL: http://svn.apache.org/viewvc/hive/branches/llap/llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelCacheImpl.java?rev=1668758&r1=1668757&r2=1668758&view=diff
==============================================================================
--- hive/branches/llap/llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelCacheImpl.java (original)
+++ hive/branches/llap/llap-server/src/java/org/apache/hadoop/hive/llap/cache/LowLevelCacheImpl.java Mon Mar 23 23:07:59 2015
@@ -113,6 +113,7 @@ public class LowLevelCacheImpl implement
       assert currentNotCached != null;
       Map.Entry<Long, LlapDataBuffer> e = matches.next();
       LlapDataBuffer buffer = e.getValue();
+      long requestedLength = currentNotCached.getLength();
       // Lock the buffer, validate it and add to results.
       if (DebugUtils.isTraceLockingEnabled()) {
         LlapIoImpl.LOG.info("Locking " + buffer + " during get");
@@ -133,7 +134,7 @@ public class LowLevelCacheImpl implement
       currentNotCached = addCachedBufferToIter(currentNotCached, currentCached, baseOffset);
       // Now that we've added it into correct position, we can adjust it by base offset.
       currentCached.shiftBy(-baseOffset);
-      metrics.incrCacheHitBytes(currentCached.getLength());
+      metrics.incrCacheHitBytes(Math.min(requestedLength, currentCached.getLength()));
     }
   }