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 a27964f..5e07ffb 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 @@ -23,6 +23,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; +import groovy.util.slurpersupport.FilteredAttributes; + import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; @@ -131,8 +133,11 @@ public BuddyAllocator(boolean isDirectVal, boolean isMappedVal, int minAllocVal, maxAllocation = maxAllocVal; if (isMapped) { try { - cacheDir = Files.createTempDirectory( - FileSystems.getDefault().getPath(mapPath), "llap-", RWX); + Path path = FileSystems.getDefault().getPath(mapPath); + if (!Files.exists(path)) { + Files.createDirectory(path); + } + cacheDir = Files.createTempDirectory(path, "llap-", RWX); } catch (IOException ioe) { // conf validator already checks this, so it will never trigger usually throw new AssertionError("Configured mmap directory should be writable", ioe); 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 b3179c0..51577bd 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 @@ -179,6 +179,13 @@ public Void call() throws Exception { } } + @Test + public void testCachedirCreated() throws Exception { + int min = 3, max = 8, maxAlloc = 1 << max; + new BuddyAllocator(isDirect, isMapped, 1 << min, maxAlloc, maxAlloc, maxAlloc, 0, tmpDir + "/testifcreated", + new DummyMemoryManager(), LlapDaemonCacheMetrics.create("test", "1"), null); + } + static void syncThreadStart(final CountDownLatch cdlIn, final CountDownLatch cdlOut) { cdlIn.countDown(); try {