git commit: PHOENIX-1341 Exit status for PhoenixRuntime

2014-10-13 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/master a11f0d9f2 - 656acefd1


PHOENIX-1341 Exit status for PhoenixRuntime

Return a non-zero exit status on a failure in PhoenixRuntime.

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/656acefd
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/656acefd
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/656acefd

Branch: refs/heads/master
Commit: 656acefd146d515de108f3a757ddb0522ea783d0
Parents: a11f0d9
Author: Brian Johnson git...@brianjohnson.cc
Authored: Sat Oct 11 14:30:37 2014 -0700
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Oct 13 09:01:41 2014 +0200

--
 .../org/apache/phoenix/util/PhoenixRuntime.java | 61 ++--
 1 file changed, 32 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/656acefd/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
index 7de27c2..9d83a60 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
@@ -63,10 +63,10 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 
 /**
- * 
+ *
  * Collection of non JDBC compliant utility methods
  *
- * 
+ *
  * @since 0.1
  */
 public class PhoenixRuntime {
@@ -84,19 +84,19 @@ public class PhoenixRuntime {
 public final static String JDBC_PROTOCOL = jdbc:phoenix;
 public final static char JDBC_PROTOCOL_TERMINATOR = ';';
 public final static char JDBC_PROTOCOL_SEPARATOR = ':';
-
+
 @Deprecated
 public final static String EMBEDDED_JDBC_PROTOCOL = 
PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR;
-
+
 /**
  * Use this connection property to control the number of rows that are
  * batched together on an UPSERT INTO table1... SELECT ... FROM table2.
  * It's only used when autoCommit is true and your source table is
- * different than your target table or your SELECT statement has a 
+ * different than your target table or your SELECT statement has a
  * GROUP BY clause.
  */
 public final static String UPSERT_BATCH_SIZE_ATTRIB = UpsertBatchSize;
-
+
 /**
  * Use this connection property to help with fairness of resource 
allocation
  * for the client and server. The value of the attribute determines the
@@ -105,7 +105,7 @@ public class PhoenixRuntime {
  * configuration properties
  */
 public static final String TENANT_ID_ATTRIB = TenantId;
-
+
 /**
  * Use this connection property prefix for annotations that you want to 
show up in traces and log lines emitted by Phoenix.
  * This is useful for annotating connections with information available on 
the client (e.g. user or session identifier) and
@@ -119,7 +119,7 @@ public class PhoenixRuntime {
  * upserting data into them, and getting the uncommitted state through 
{@link #getUncommittedData(Connection)}
  */
 public final static String CONNECTIONLESS = none;
-
+
 private static final String HEADER_IN_LINE = in-line;
 private static final String SQL_FILE_EXT = .sql;
 private static final String CSV_FILE_EXT = .csv;
@@ -137,6 +137,8 @@ public class PhoenixRuntime {
 ExecutionCommand execCmd = ExecutionCommand.parseArgs(args);
 String jdbcUrl = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + 
execCmd.getConnectionString();
 
+int exitStatus = 0;
+
 PhoenixConnection conn = null;
 try {
 Properties props = new Properties();
@@ -165,6 +167,7 @@ public class PhoenixRuntime {
 }
 } catch (Throwable t) {
 t.printStackTrace();
+exitStatus = 1;
 } finally {
 if (conn != null) {
 try {
@@ -173,7 +176,7 @@ public class PhoenixRuntime {
 //going to shut jvm down anyway. So might as well feast on 
it.
 }
 }
-System.exit(0);
+System.exit(exitStatus);
 }
 }
 
@@ -181,7 +184,7 @@ public class PhoenixRuntime {
 
 private PhoenixRuntime() {
 }
-
+
 /**
  * Runs a series of semicolon-terminated SQL statements using the 
connection provided, returning
  * the number of SQL statements executed. Note that if the connection has 
specified an SCN through
@@ -200,13 +203,13 @@ public class PhoenixRuntime {
 pconn.setAutoCommit(true);
 

git commit: PHOENIX-1341 Exit status for PhoenixRuntime

2014-10-13 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/3.0 ed3e3f55f - d42866918


PHOENIX-1341 Exit status for PhoenixRuntime

Return a non-zero exit status on a failure in PhoenixRuntime.

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/d4286691
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/d4286691
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/d4286691

Branch: refs/heads/3.0
Commit: d42866918448d18e32fbdf3266dd8add7ec1b428
Parents: ed3e3f5
Author: Brian Johnson git...@brianjohnson.cc
Authored: Sat Oct 11 14:30:37 2014 -0700
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Oct 13 09:57:43 2014 +0200

--
 .../src/main/java/org/apache/phoenix/util/PhoenixRuntime.java | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d4286691/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
index fdcc02a..064ca62 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
@@ -129,6 +129,8 @@ public class PhoenixRuntime {
 ExecutionCommand execCmd = ExecutionCommand.parseArgs(args);
 String jdbcUrl = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + 
execCmd.getConnectionString();
 
+int exitStatus = 0;
+
 PhoenixConnection conn = null;
 try {
 Properties props = new Properties();
@@ -157,6 +159,7 @@ public class PhoenixRuntime {
 }
 } catch (Throwable t) {
 t.printStackTrace();
+exitStatus = 1;
 } finally {
 if (conn != null) {
 try {
@@ -165,7 +168,7 @@ public class PhoenixRuntime {
 //going to shut jvm down anyway. So might as well feast on 
it.
 }
 }
-System.exit(0);
+System.exit(exitStatus);
 }
 }
 
@@ -414,7 +417,7 @@ public class PhoenixRuntime {
 output.write(QueryConstants.SEPARATOR_BYTE);
 }
 type = pkColumns.get(i).getDataType();
-
+
 //for fixed width data types like CHAR and BINARY, we need to 
pad values to be of max length.
 Object paddedObj = type.pad(values[i - offset], 
pkColumns.get(i).getMaxLength());
 byte[] value = type.toBytes(paddedObj);



git commit: PHOENIX-1341 Exit status for PhoenixRuntime

2014-10-13 Thread greid
Repository: phoenix
Updated Branches:
  refs/heads/4.0 ab8b17d79 - debf09265


PHOENIX-1341 Exit status for PhoenixRuntime

Return a non-zero exit status on a failure in PhoenixRuntime.

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/debf0926
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/debf0926
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/debf0926

Branch: refs/heads/4.0
Commit: debf09265a1236d5d020be3eab2e1fb86f97fa28
Parents: ab8b17d
Author: Brian Johnson git...@brianjohnson.cc
Authored: Sat Oct 11 14:30:37 2014 -0700
Committer: Gabriel Reid gabri...@ngdata.com
Committed: Mon Oct 13 09:03:41 2014 +0200

--
 .../org/apache/phoenix/util/PhoenixRuntime.java | 61 ++--
 1 file changed, 32 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/debf0926/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
index 9b0ecaf..492e940 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java
@@ -65,10 +65,10 @@ import org.apache.phoenix.schema.TableNotFoundException;
 import com.google.common.collect.Lists;
 
 /**
- * 
+ *
  * Collection of non JDBC compliant utility methods
  *
- * 
+ *
  * @since 0.1
  */
 public class PhoenixRuntime {
@@ -86,19 +86,19 @@ public class PhoenixRuntime {
 public final static String JDBC_PROTOCOL = jdbc:phoenix;
 public final static char JDBC_PROTOCOL_TERMINATOR = ';';
 public final static char JDBC_PROTOCOL_SEPARATOR = ':';
-
+
 @Deprecated
 public final static String EMBEDDED_JDBC_PROTOCOL = 
PhoenixRuntime.JDBC_PROTOCOL + PhoenixRuntime.JDBC_PROTOCOL_SEPARATOR;
-
+
 /**
  * Use this connection property to control the number of rows that are
  * batched together on an UPSERT INTO table1... SELECT ... FROM table2.
  * It's only used when autoCommit is true and your source table is
- * different than your target table or your SELECT statement has a 
+ * different than your target table or your SELECT statement has a
  * GROUP BY clause.
  */
 public final static String UPSERT_BATCH_SIZE_ATTRIB = UpsertBatchSize;
-
+
 /**
  * Use this connection property to help with fairness of resource 
allocation
  * for the client and server. The value of the attribute determines the
@@ -107,7 +107,7 @@ public class PhoenixRuntime {
  * configuration properties
  */
 public static final String TENANT_ID_ATTRIB = TenantId;
-
+
 /**
  * Use this connection property prefix for annotations that you want to 
show up in traces and log lines emitted by Phoenix.
  * This is useful for annotating connections with information available on 
the client (e.g. user or session identifier) and
@@ -121,7 +121,7 @@ public class PhoenixRuntime {
  * upserting data into them, and getting the uncommitted state through 
{@link #getUncommittedData(Connection)}
  */
 public final static String CONNECTIONLESS = none;
-
+
 private static final String HEADER_IN_LINE = in-line;
 private static final String SQL_FILE_EXT = .sql;
 private static final String CSV_FILE_EXT = .csv;
@@ -139,6 +139,8 @@ public class PhoenixRuntime {
 ExecutionCommand execCmd = ExecutionCommand.parseArgs(args);
 String jdbcUrl = JDBC_PROTOCOL + JDBC_PROTOCOL_SEPARATOR + 
execCmd.getConnectionString();
 
+int exitStatus = 0;
+
 PhoenixConnection conn = null;
 try {
 Properties props = new Properties();
@@ -167,6 +169,7 @@ public class PhoenixRuntime {
 }
 } catch (Throwable t) {
 t.printStackTrace();
+exitStatus = 1;
 } finally {
 if (conn != null) {
 try {
@@ -175,7 +178,7 @@ public class PhoenixRuntime {
 //going to shut jvm down anyway. So might as well feast on 
it.
 }
 }
-System.exit(0);
+System.exit(exitStatus);
 }
 }
 
@@ -183,7 +186,7 @@ public class PhoenixRuntime {
 
 private PhoenixRuntime() {
 }
-
+
 /**
  * Runs a series of semicolon-terminated SQL statements using the 
connection provided, returning
  * the number of SQL statements executed. Note that if the connection has 
specified an SCN through
@@ -202,13 +205,13 @@ public class PhoenixRuntime {
 pconn.setAutoCommit(true);