You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2017/04/27 20:07:56 UTC

[8/8] hive git commit: HIVE-16545 : LLAP: bug in arena size determination logic (Sergey Shelukhin, reviewed by Prasanth Jayachandran)

HIVE-16545 : LLAP: bug in arena size determination logic (Sergey Shelukhin, reviewed by Prasanth Jayachandran)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/3403535d
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/3403535d
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/3403535d

Branch: refs/heads/branch-2.2
Commit: 3403535d32ed914c99712d38ef2d04f6c8a6a7d2
Parents: c84468e
Author: sergey <se...@apache.org>
Authored: Thu Apr 27 11:53:25 2017 -0700
Committer: sergey <se...@apache.org>
Committed: Thu Apr 27 12:44:20 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/3403535d/llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java
----------------------------------------------------------------------
diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java b/llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java
index 95cc11e..7ed52b0 100644
--- a/llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java
+++ b/llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java
@@ -118,7 +118,8 @@ public final class BuddyAllocator implements EvictionAwareAllocator, BuddyAlloca
     } else {
       cacheDir = null;
     }
-    int arenaSizeVal = (arenaCount == 0) ? MAX_ARENA_SIZE : (int)(maxSizeVal / arenaCount);
+    long arenaSizeVal = (arenaCount == 0) ? MAX_ARENA_SIZE : maxSizeVal / arenaCount;
+    // The math.min, and the fact that maxAllocation is an int, ensures we don't overflow.
     arenaSizeVal = Math.max(maxAllocation, Math.min(arenaSizeVal, MAX_ARENA_SIZE));
     if (LlapIoImpl.LOG.isInfoEnabled()) {
       LlapIoImpl.LOG.info("Buddy allocator with " + (isDirect ? "direct" : "byte") + " buffers;"
@@ -147,7 +148,7 @@ public final class BuddyAllocator implements EvictionAwareAllocator, BuddyAlloca
       LlapIoImpl.LOG.warn("Rounding arena size to " + arenaSizeVal + " from " + oldArenaSize
           + " to be divisible by allocation size " + maxAllocation);
     }
-    arenaSize = arenaSizeVal;
+    arenaSize = (int)arenaSizeVal;
     if ((maxSizeVal % arenaSize) > 0) {
       long oldMaxSize = maxSizeVal;
       maxSizeVal = (maxSizeVal / arenaSize) * arenaSize;