git commit: PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle)
Repository: phoenix Updated Branches: refs/heads/3.0 ff47a9594 -> d3e6a9fa2 PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/d3e6a9fa Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d3e6a9fa Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d3e6a9fa Branch: refs/heads/3.0 Commit: d3e6a9fa2e6c660ffd0eca9f99eae391070bb6c3 Parents: ff47a95 Author: Jeffrey Zhong Authored: Fri Oct 3 17:18:01 2014 -0700 Committer: Jeffrey Zhong Committed: Fri Oct 3 17:40:12 2014 -0700 -- .../phoenix/cache/aggcache/SpillFile.java | 42 +++- .../phoenix/cache/aggcache/SpillManager.java| 6 ++- 2 files changed, 28 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3e6a9fa/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java index 8dd64d0..51aef98 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java @@ -18,6 +18,12 @@ package org.apache.phoenix.cache.aggcache; +import com.google.common.collect.Maps; +import org.apache.hadoop.conf.Configuration; +import org.apache.phoenix.util.Closeables; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.Closeable; import java.io.File; import java.io.IOException; @@ -28,12 +34,6 @@ import java.nio.channels.FileChannel.MapMode; import java.util.Map; import java.util.UUID; -import org.apache.phoenix.util.Closeables; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.Maps; - /** * This class abstracts a SpillFile It is a accessible on a per page basis * For every SpillFile object a single spill file is always created. @@ -49,6 +49,8 @@ public class SpillFile implements Closeable { static final int DEFAULT_PAGE_SIZE = 4096; // Map of initial SpillFile at index 0, and overflow spillFiles private Map tempFiles; +// Custom spill files directory +private File spillFilesDirectory = null; // Wrapper class for a TempFile: File + RandomAccessFile private static class TempFile implements Closeable{ @@ -81,22 +83,31 @@ public class SpillFile implements Closeable { } } } - + +private SpillFile(File spillFilesDirectory) throws IOException { + this.spillFilesDirectory = spillFilesDirectory; + this.tempFiles = Maps.newHashMap(); + // Init the first pre-allocated spillFile + tempFiles.put(0, createTempFile()); +} + /** * Create a new SpillFile using the Java TempFile creation function. SpillFile is access in * pages. */ -public static SpillFile createSpillFile() { - try { - return new SpillFile(createTempFile()); +public static SpillFile createSpillFile(File spillFilesDir) { + try { + return new SpillFile(spillFilesDir); } catch (IOException ioe) { throw new RuntimeException("Could not create Spillfile " + ioe); } } -private static TempFile createTempFile() throws IOException { -File tempFile = File.createTempFile(UUID.randomUUID().toString(), null); +private TempFile createTempFile() throws IOException { +// Create temp file in temp dir or custom dir if provided +File tempFile = File.createTempFile(UUID.randomUUID().toString(), + null, spillFilesDirectory); if (logger.isDebugEnabled()) { logger.debug("Creating new SpillFile: " + tempFile.getAbsolutePath()); } @@ -106,13 +117,6 @@ public class SpillFile implements Closeable { return new TempFile(tempFile, file); } - -private SpillFile(TempFile spFile) throws IOException { -this.tempFiles = Maps.newHashMap(); -// Init the first pre-allocated spillFile -tempFiles.put(0, spFile); -} - /** * Random access to a page of the current spill file * @param index http://git-wip-us.apache.org/repos/asf/phoenix/blob/d3e6a9fa/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java index 2fbea
git commit: PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle)
Repository: phoenix Updated Branches: refs/heads/4.0 51f69bcb6 -> 6e89ee5dc PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/6e89ee5d Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/6e89ee5d Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/6e89ee5d Branch: refs/heads/4.0 Commit: 6e89ee5dc25aa76dc94e7b6b5adbc9d15debcb36 Parents: 51f69bc Author: Jeffrey Zhong Authored: Fri Oct 3 17:18:01 2014 -0700 Committer: Jeffrey Zhong Committed: Fri Oct 3 17:20:27 2014 -0700 -- .../phoenix/cache/aggcache/SpillFile.java | 42 +++- .../phoenix/cache/aggcache/SpillManager.java| 6 ++- 2 files changed, 28 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e89ee5d/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java index 8dd64d0..51aef98 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java @@ -18,6 +18,12 @@ package org.apache.phoenix.cache.aggcache; +import com.google.common.collect.Maps; +import org.apache.hadoop.conf.Configuration; +import org.apache.phoenix.util.Closeables; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.Closeable; import java.io.File; import java.io.IOException; @@ -28,12 +34,6 @@ import java.nio.channels.FileChannel.MapMode; import java.util.Map; import java.util.UUID; -import org.apache.phoenix.util.Closeables; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.Maps; - /** * This class abstracts a SpillFile It is a accessible on a per page basis * For every SpillFile object a single spill file is always created. @@ -49,6 +49,8 @@ public class SpillFile implements Closeable { static final int DEFAULT_PAGE_SIZE = 4096; // Map of initial SpillFile at index 0, and overflow spillFiles private Map tempFiles; +// Custom spill files directory +private File spillFilesDirectory = null; // Wrapper class for a TempFile: File + RandomAccessFile private static class TempFile implements Closeable{ @@ -81,22 +83,31 @@ public class SpillFile implements Closeable { } } } - + +private SpillFile(File spillFilesDirectory) throws IOException { + this.spillFilesDirectory = spillFilesDirectory; + this.tempFiles = Maps.newHashMap(); + // Init the first pre-allocated spillFile + tempFiles.put(0, createTempFile()); +} + /** * Create a new SpillFile using the Java TempFile creation function. SpillFile is access in * pages. */ -public static SpillFile createSpillFile() { - try { - return new SpillFile(createTempFile()); +public static SpillFile createSpillFile(File spillFilesDir) { + try { + return new SpillFile(spillFilesDir); } catch (IOException ioe) { throw new RuntimeException("Could not create Spillfile " + ioe); } } -private static TempFile createTempFile() throws IOException { -File tempFile = File.createTempFile(UUID.randomUUID().toString(), null); +private TempFile createTempFile() throws IOException { +// Create temp file in temp dir or custom dir if provided +File tempFile = File.createTempFile(UUID.randomUUID().toString(), + null, spillFilesDirectory); if (logger.isDebugEnabled()) { logger.debug("Creating new SpillFile: " + tempFile.getAbsolutePath()); } @@ -106,13 +117,6 @@ public class SpillFile implements Closeable { return new TempFile(tempFile, file); } - -private SpillFile(TempFile spFile) throws IOException { -this.tempFiles = Maps.newHashMap(); -// Init the first pre-allocated spillFile -tempFiles.put(0, spFile); -} - /** * Random access to a page of the current spill file * @param index http://git-wip-us.apache.org/repos/asf/phoenix/blob/6e89ee5d/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java index 2fbea
git commit: PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle)
Repository: phoenix Updated Branches: refs/heads/master a55c03cc9 -> 051e40843 PHOENIX-1310: Spill files filling up /tmp on server(Siddharth Wagle) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/051e4084 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/051e4084 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/051e4084 Branch: refs/heads/master Commit: 051e40843bb2c8154d31f54ef17ae66cd2824d4f Parents: a55c03c Author: Jeffrey Zhong Authored: Fri Oct 3 17:18:01 2014 -0700 Committer: Jeffrey Zhong Committed: Fri Oct 3 17:18:01 2014 -0700 -- .../phoenix/cache/aggcache/SpillFile.java | 42 +++- .../phoenix/cache/aggcache/SpillManager.java| 6 ++- 2 files changed, 28 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/051e4084/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java index 8dd64d0..51aef98 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillFile.java @@ -18,6 +18,12 @@ package org.apache.phoenix.cache.aggcache; +import com.google.common.collect.Maps; +import org.apache.hadoop.conf.Configuration; +import org.apache.phoenix.util.Closeables; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.Closeable; import java.io.File; import java.io.IOException; @@ -28,12 +34,6 @@ import java.nio.channels.FileChannel.MapMode; import java.util.Map; import java.util.UUID; -import org.apache.phoenix.util.Closeables; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.collect.Maps; - /** * This class abstracts a SpillFile It is a accessible on a per page basis * For every SpillFile object a single spill file is always created. @@ -49,6 +49,8 @@ public class SpillFile implements Closeable { static final int DEFAULT_PAGE_SIZE = 4096; // Map of initial SpillFile at index 0, and overflow spillFiles private Map tempFiles; +// Custom spill files directory +private File spillFilesDirectory = null; // Wrapper class for a TempFile: File + RandomAccessFile private static class TempFile implements Closeable{ @@ -81,22 +83,31 @@ public class SpillFile implements Closeable { } } } - + +private SpillFile(File spillFilesDirectory) throws IOException { + this.spillFilesDirectory = spillFilesDirectory; + this.tempFiles = Maps.newHashMap(); + // Init the first pre-allocated spillFile + tempFiles.put(0, createTempFile()); +} + /** * Create a new SpillFile using the Java TempFile creation function. SpillFile is access in * pages. */ -public static SpillFile createSpillFile() { - try { - return new SpillFile(createTempFile()); +public static SpillFile createSpillFile(File spillFilesDir) { + try { + return new SpillFile(spillFilesDir); } catch (IOException ioe) { throw new RuntimeException("Could not create Spillfile " + ioe); } } -private static TempFile createTempFile() throws IOException { -File tempFile = File.createTempFile(UUID.randomUUID().toString(), null); +private TempFile createTempFile() throws IOException { +// Create temp file in temp dir or custom dir if provided +File tempFile = File.createTempFile(UUID.randomUUID().toString(), + null, spillFilesDirectory); if (logger.isDebugEnabled()) { logger.debug("Creating new SpillFile: " + tempFile.getAbsolutePath()); } @@ -106,13 +117,6 @@ public class SpillFile implements Closeable { return new TempFile(tempFile, file); } - -private SpillFile(TempFile spFile) throws IOException { -this.tempFiles = Maps.newHashMap(); -// Init the first pre-allocated spillFile -tempFiles.put(0, spFile); -} - /** * Random access to a page of the current spill file * @param index http://git-wip-us.apache.org/repos/asf/phoenix/blob/051e4084/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java b/phoenix-core/src/main/java/org/apache/phoenix/cache/aggcache/SpillManager.java index