You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by bs...@apache.org on 2019/10/19 02:23:09 UTC

[hive] branch master updated: HIVE-22175: Fix TestBudyAllocator#testMTT by rechecking if other thread has created new arena (John Sherman reviewed by Slim Bouguerra)

This is an automated email from the ASF dual-hosted git repository.

bslim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 88314ee  HIVE-22175: Fix TestBudyAllocator#testMTT by rechecking if other thread has created new arena (John Sherman reviewed by Slim Bouguerra)
88314ee is described below

commit 88314ee794afa34ab8acf779630326b2ba52e815
Author: John Sherman <jf...@cloudera.com>
AuthorDate: Fri Oct 18 19:22:43 2019 -0700

    HIVE-22175: Fix TestBudyAllocator#testMTT by rechecking if other thread has created new arena (John Sherman reviewed by Slim Bouguerra)
---
 .../src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java   | 5 +++++
 .../test/org/apache/hadoop/hive/llap/cache/TestBuddyAllocator.java   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

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 9e7a8dc..341da25 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
@@ -331,6 +331,9 @@ public final class BuddyAllocator
       return;
     }
 
+    // Another thread might have allocated a new arena
+    arenaCount = getArenaCount();
+
     // We called reserveMemory so we know that there's memory waiting for us somewhere.
     // But that can mean that the reserved memory is fragmented thus unusable
     // or we have a common class of rare race conditions related to the order of locking/checking of
@@ -453,6 +456,8 @@ public final class BuddyAllocator
           logOomErrorMessage(msg);
           throw new AllocatorOutOfMemoryException(msg);
         }
+        // Another thread might have allocated a new arena for us to check
+        arenaCount = getArenaCount();
         ++discardsAttempt;
       }
     } finally {
diff --git a/llap-server/src/test/org/apache/hadoop/hive/llap/cache/TestBuddyAllocator.java b/llap-server/src/test/org/apache/hadoop/hive/llap/cache/TestBuddyAllocator.java
index 506d9d1..8b3ffdd 100644
--- a/llap-server/src/test/org/apache/hadoop/hive/llap/cache/TestBuddyAllocator.java
+++ b/llap-server/src/test/org/apache/hadoop/hive/llap/cache/TestBuddyAllocator.java
@@ -105,7 +105,7 @@ public class TestBuddyAllocator {
     allocSameSize(a, arenaCount * 2, allocLog2);
   }
 
-  /*  HIVE-22286: Disabled test until HIVE-22175 is resolved @Test */
+  @Test
   public void testMTT() {
     final int min = 3, max = 8, maxAlloc = 1 << max, allocsPerSize = 3;
     final BuddyAllocator a = new BuddyAllocator(isDirect, isMapped, 1 << min, maxAlloc,