git commit: PHOENIX-1216 fix code Change spooling directory

2014-09-16 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/master 20e7559b4 - 173c7d72d


PHOENIX-1216 fix code Change spooling directory

Make the spooling directory configurable.

Signed-off-by: Gabriel Reid gabri...@ngdata.com


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/173c7d72
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/173c7d72
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/173c7d72

Branch: refs/heads/master
Commit: 173c7d72defbb5a73a36fd5c8c12c8e621295e70
Parents: 20e7559
Author: sofangel sofan...@naver.com
Authored: Tue Sep 16 15:31:34 2014 +0900
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Tue Sep 16 12:25:47 2014 +0200

--
 .../phoenix/iterate/SpoolingResultIterator.java | 57 ++--
 .../org/apache/phoenix/query/QueryServices.java |  2 +-
 .../phoenix/query/QueryServicesOptions.java | 11 +++-
 .../iterate/SpoolingResultIteratorTest.java |  2 +-
 .../phoenix/query/QueryServicesTestImpl.java|  2 +
 5 files changed, 42 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/173c7d72/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index 4672657..42a61a7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -47,19 +47,19 @@ import org.apache.phoenix.util.TupleUtil;
 
 
 /**
- * 
+ *
  * Result iterator that spools the results of a scan to disk once an in-memory 
threshold has been reached.
  * If the in-memory threshold is not reached, the results are held in memory 
with no disk writing perfomed.
  *
- * 
+ *
  * @since 0.1
  */
 public class SpoolingResultIterator implements PeekingResultIterator {
 private final PeekingResultIterator spoolFrom;
-
+
 public static class SpoolingResultIteratorFactory implements 
ParallelIteratorFactory {
 private final QueryServices services;
-
+
 public SpoolingResultIteratorFactory(QueryServices services) {
 this.services = services;
 }
@@ -67,15 +67,16 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 return new SpoolingResultIterator(scanner, services);
 }
-
+
 }
 
 public SpoolingResultIterator(ResultIterator scanner, QueryServices 
services) throws SQLException {
-this (scanner, services.getMemoryManager(), 
-   
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES),
-   
services.getProps().getLong(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES));
+this (scanner, services.getMemoryManager(),
+
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES),
+
services.getProps().getLong(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES),
+services.getProps().get(QueryServices.SPOOL_DIRECTORY, 
QueryServicesOptions.DEFAULT_SPOOL_DIRECTORY));
 }
-
+
 /**
 * Create a result iterator by iterating through the results of a scan, 
spooling them to disk once
 * a threshold has been reached. The scanner passed in is closed prior to 
returning.
@@ -85,7 +86,7 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 *  the memory manager) is exceeded.
 * @throws SQLException
 */
-SpoolingResultIterator(ResultIterator scanner, MemoryManager mm, final int 
thresholdBytes, final long maxSpoolToDisk) throws SQLException {
+SpoolingResultIterator(ResultIterator scanner, MemoryManager mm, final int 
thresholdBytes, final long maxSpoolToDisk, final String spoolDirectory) throws 
SQLException {
 boolean success = false;
 boolean usedOnDiskIterator = false;
 final MemoryChunk chunk = mm.allocate(0, thresholdBytes);
@@ -93,7 +94,7 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 try {
 // Can't be bigger than int, since it's the max of the above 
allocation
 int size = (int)chunk.getSize();
-tempFile = 

git commit: PHOENIX-1216 fix code Change spooling directory

2014-09-16 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/3.0 7a9fd9981 - b51318d09


PHOENIX-1216 fix code Change spooling directory

Make the spooling directory configurable.

Signed-off-by: Gabriel Reid gabri...@ngdata.com


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

Branch: refs/heads/3.0
Commit: b51318d09bd450c906e7b65348d54ea73151099f
Parents: 7a9fd99
Author: sofangel sofan...@naver.com
Authored: Tue Sep 16 15:31:34 2014 +0900
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Tue Sep 16 12:06:24 2014 +0200

--
 .../phoenix/iterate/SpoolingResultIterator.java | 59 ++--
 .../org/apache/phoenix/query/QueryServices.java |  2 +-
 .../phoenix/query/QueryServicesOptions.java | 11 +++-
 .../iterate/SpoolingResultIteratorTest.java |  2 +-
 .../phoenix/query/QueryServicesTestImpl.java|  2 +
 5 files changed, 43 insertions(+), 33 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/b51318d0/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index 22cd049..f35999e 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -47,19 +47,19 @@ import org.apache.phoenix.util.TupleUtil;
 
 
 /**
- * 
+ *
  * Result iterator that spools the results of a scan to disk once an in-memory 
threshold has been reached.
  * If the in-memory threshold is not reached, the results are held in memory 
with no disk writing perfomed.
  *
- * 
+ *
  * @since 0.1
  */
 public class SpoolingResultIterator implements PeekingResultIterator {
 private final PeekingResultIterator spoolFrom;
-
+
 public static class SpoolingResultIteratorFactory implements 
ParallelIteratorFactory {
 private final QueryServices services;
-
+
 public SpoolingResultIteratorFactory(QueryServices services) {
 this.services = services;
 }
@@ -67,15 +67,16 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 return new SpoolingResultIterator(scanner, services);
 }
-
+
 }
 
 public SpoolingResultIterator(ResultIterator scanner, QueryServices 
services) throws SQLException {
-this (scanner, services.getMemoryManager(), 
-   
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES),
-   
services.getProps().getLong(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES));
+this (scanner, services.getMemoryManager(),
+
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES),
+
services.getProps().getLong(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES),
+services.getProps().get(QueryServices.SPOOL_DIRECTORY, 
QueryServicesOptions.DEFAULT_SPOOL_DIRECTORY));
 }
-
+
 /**
 * Create a result iterator by iterating through the results of a scan, 
spooling them to disk once
 * a threshold has been reached. The scanner passed in is closed prior to 
returning.
@@ -85,7 +86,7 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 *  the memory manager) is exceeded.
 * @throws SQLException
 */
-SpoolingResultIterator(ResultIterator scanner, MemoryManager mm, final int 
thresholdBytes, final long maxSpoolToDisk) throws SQLException {
+SpoolingResultIterator(ResultIterator scanner, MemoryManager mm, final int 
thresholdBytes, final long maxSpoolToDisk, final String spoolDirectory) throws 
SQLException {
 boolean success = false;
 boolean usedOnDiskIterator = false;
 final MemoryChunk chunk = mm.allocate(0, thresholdBytes);
@@ -93,7 +94,7 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 try {
 // Can't be bigger than int, since it's the max of the above 
allocation
 int size = (int)chunk.getSize();
-tempFile = File.createTempFile(ResultSpooler,.bin);
+

git commit: PHOENIX-1216 fix code Change spooling directory

2014-09-16 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/4.0 caa7848cf - c2712bf2b


PHOENIX-1216 fix code Change spooling directory

Make the spooling directory configurable.

Signed-off-by: Gabriel Reid gabri...@ngdata.com


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

Branch: refs/heads/4.0
Commit: c2712bf2b1233fffcf9d236a51e04ff4997b337f
Parents: caa7848
Author: sofangel sofan...@naver.com
Authored: Tue Sep 16 15:31:34 2014 +0900
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Tue Sep 16 12:06:47 2014 +0200

--
 .../phoenix/iterate/SpoolingResultIterator.java | 57 ++--
 .../org/apache/phoenix/query/QueryServices.java |  2 +-
 .../phoenix/query/QueryServicesOptions.java | 11 +++-
 .../iterate/SpoolingResultIteratorTest.java |  2 +-
 .../phoenix/query/QueryServicesTestImpl.java|  2 +
 5 files changed, 42 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2712bf2/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
index 4672657..42a61a7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/SpoolingResultIterator.java
@@ -47,19 +47,19 @@ import org.apache.phoenix.util.TupleUtil;
 
 
 /**
- * 
+ *
  * Result iterator that spools the results of a scan to disk once an in-memory 
threshold has been reached.
  * If the in-memory threshold is not reached, the results are held in memory 
with no disk writing perfomed.
  *
- * 
+ *
  * @since 0.1
  */
 public class SpoolingResultIterator implements PeekingResultIterator {
 private final PeekingResultIterator spoolFrom;
-
+
 public static class SpoolingResultIteratorFactory implements 
ParallelIteratorFactory {
 private final QueryServices services;
-
+
 public SpoolingResultIteratorFactory(QueryServices services) {
 this.services = services;
 }
@@ -67,15 +67,16 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 public PeekingResultIterator newIterator(StatementContext context, 
ResultIterator scanner, Scan scan) throws SQLException {
 return new SpoolingResultIterator(scanner, services);
 }
-
+
 }
 
 public SpoolingResultIterator(ResultIterator scanner, QueryServices 
services) throws SQLException {
-this (scanner, services.getMemoryManager(), 
-   
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES),
-   
services.getProps().getLong(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES));
+this (scanner, services.getMemoryManager(),
+
services.getProps().getInt(QueryServices.SPOOL_THRESHOLD_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_SPOOL_THRESHOLD_BYTES),
+
services.getProps().getLong(QueryServices.MAX_SPOOL_TO_DISK_BYTES_ATTRIB, 
QueryServicesOptions.DEFAULT_MAX_SPOOL_TO_DISK_BYTES),
+services.getProps().get(QueryServices.SPOOL_DIRECTORY, 
QueryServicesOptions.DEFAULT_SPOOL_DIRECTORY));
 }
-
+
 /**
 * Create a result iterator by iterating through the results of a scan, 
spooling them to disk once
 * a threshold has been reached. The scanner passed in is closed prior to 
returning.
@@ -85,7 +86,7 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 *  the memory manager) is exceeded.
 * @throws SQLException
 */
-SpoolingResultIterator(ResultIterator scanner, MemoryManager mm, final int 
thresholdBytes, final long maxSpoolToDisk) throws SQLException {
+SpoolingResultIterator(ResultIterator scanner, MemoryManager mm, final int 
thresholdBytes, final long maxSpoolToDisk, final String spoolDirectory) throws 
SQLException {
 boolean success = false;
 boolean usedOnDiskIterator = false;
 final MemoryChunk chunk = mm.allocate(0, thresholdBytes);
@@ -93,7 +94,7 @@ public class SpoolingResultIterator implements 
PeekingResultIterator {
 try {
 // Can't be bigger than int, since it's the max of the above 
allocation
 int size = (int)chunk.getSize();
-tempFile = File.createTempFile(ResultSpooler,.bin);
+