git commit: PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet
Repository: phoenix Updated Branches: refs/heads/master 4e19c8cfb - a41dc5254 PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a41dc525 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a41dc525 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a41dc525 Branch: refs/heads/master Commit: a41dc5254aaf90796e208b1a4bd8d14b2c61b018 Parents: 4e19c8c Author: Jeffrey Zhong jeffr...@apache.org Authored: Wed Jul 16 17:27:14 2014 -0700 Committer: Jeffrey Zhong jeffr...@apache.org Committed: Wed Jul 16 17:27:14 2014 -0700 -- bin/log4j.properties | 4 +++- bin/sqlline.py | 14 +- 2 files changed, 16 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a41dc525/bin/log4j.properties -- diff --git a/bin/log4j.properties b/bin/log4j.properties index 30119bc..47d45e8 100644 --- a/bin/log4j.properties +++ b/bin/log4j.properties @@ -65,5 +65,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n # Custom Logging levels -log4j.logger.org.apache.zookeeper=WARN +log4j.logger.org.apache.zookeeper=ERROR +log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR +log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR http://git-wip-us.apache.org/repos/asf/phoenix/blob/a41dc525/bin/sqlline.py -- diff --git a/bin/sqlline.py b/bin/sqlline.py index 00fccdb..d42be07 100755 --- a/bin/sqlline.py +++ b/bin/sqlline.py @@ -23,6 +23,15 @@ import os import subprocess import sys import phoenix_utils +import atexit + +global childProc +childProc = None +def kill_child(): +if childProc is not None: +childProc.terminate() +childProc.kill() +atexit.register(kill_child) phoenix_utils.setPath() @@ -50,4 +59,7 @@ java_cmd = 'java -cp .' + os.pathsep + phoenix_utils.phoenix_client_jar + \ -n none -p none --color= + colorSetting + --fastConnect=false --verbose=true \ --isolation=TRANSACTION_READ_COMMITTED + sqlfile -subprocess.call(java_cmd, shell=True) +childProc = subprocess.Popen(java_cmd, shell=True) +#Wait for child process exit +(output, error) = childProc.communicate() +childProc = None
git commit: PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet
Repository: phoenix Updated Branches: refs/heads/master 9bb0b01f6 - 013e96c02 PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/013e96c0 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/013e96c0 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/013e96c0 Branch: refs/heads/master Commit: 013e96c02b50f767e8e1e17d37c4cceef018d3eb Parents: 9bb0b01 Author: Jeffrey Zhong jeffr...@apache.org Authored: Wed Jul 9 17:43:54 2014 -0700 Committer: Jeffrey Zhong jeffr...@apache.org Committed: Wed Jul 9 17:43:54 2014 -0700 -- bin/log4j.properties | 4 +++- .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++ 2 files changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/013e96c0/bin/log4j.properties -- diff --git a/bin/log4j.properties b/bin/log4j.properties index 30119bc..47d45e8 100644 --- a/bin/log4j.properties +++ b/bin/log4j.properties @@ -65,5 +65,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n # Custom Logging levels -log4j.logger.org.apache.zookeeper=WARN +log4j.logger.org.apache.zookeeper=ERROR +log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR +log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR http://git-wip-us.apache.org/repos/asf/phoenix/blob/013e96c0/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index 5eb5314..04e65e7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -1457,6 +1457,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement SQLException sqlE = null; PhoenixConnection metaConnection = null; +int origClientRetries = ConnectionQueryServicesImpl.this.config.getInt( +HConstants.HBASE_CLIENT_RETRIES_NUMBER, HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); try { openConnection(); Properties scnProps = PropertiesUtil.deepCopy(props); @@ -1464,6 +1466,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP)); scnProps.remove(PhoenixRuntime.TENANT_ID_ATTRIB); +// during initialization fast fail when connection has issues +ConnectionQueryServicesImpl.this.config.setInt( +HConstants.HBASE_CLIENT_RETRIES_NUMBER, Math.min(2,origClientRetries)); metaConnection = new PhoenixConnection( ConnectionQueryServicesImpl.this, url, scnProps, newEmptyMetaData()); try { @@ -1482,6 +1487,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } catch (SQLException e) { sqlE = e; } finally { +ConnectionQueryServicesImpl.this.config.setInt( +HConstants.HBASE_CLIENT_RETRIES_NUMBER, origClientRetries); try { if (metaConnection != null) metaConnection.close(); } catch (SQLException e) {
git commit: PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet
Repository: phoenix Updated Branches: refs/heads/4.0 8dfda14ae - 46b445bef PHOENIX-1072: Fast fail sqlline.py when pass wrong quorum string or hbase cluster hasnt' started yet Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/46b445be Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/46b445be Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/46b445be Branch: refs/heads/4.0 Commit: 46b445befb43e6257bb085c01a0a26e30ee68366 Parents: 8dfda14 Author: Jeffrey Zhong jeffr...@apache.org Authored: Wed Jul 9 17:43:54 2014 -0700 Committer: Jeffrey Zhong jeffr...@apache.org Committed: Wed Jul 9 17:49:05 2014 -0700 -- bin/log4j.properties | 4 +++- .../org/apache/phoenix/query/ConnectionQueryServicesImpl.java | 7 +++ 2 files changed, 10 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/phoenix/blob/46b445be/bin/log4j.properties -- diff --git a/bin/log4j.properties b/bin/log4j.properties index 30119bc..47d45e8 100644 --- a/bin/log4j.properties +++ b/bin/log4j.properties @@ -65,5 +65,7 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{2}: %m%n # Custom Logging levels -log4j.logger.org.apache.zookeeper=WARN +log4j.logger.org.apache.zookeeper=ERROR +log4j.logger.org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper=ERROR +log4j.logger.org.apache.hadoop.hbase.zookeeper.ZKUtil=ERROR log4j.logger.org.apache.hadoop.hbase.HBaseConfiguration=ERROR http://git-wip-us.apache.org/repos/asf/phoenix/blob/46b445be/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java -- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java index a83a0c9..be0ac7a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java @@ -1457,6 +1457,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement SQLException sqlE = null; PhoenixConnection metaConnection = null; +int origClientRetries = ConnectionQueryServicesImpl.this.config.getInt( +HConstants.HBASE_CLIENT_RETRIES_NUMBER, HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER); try { openConnection(); Properties scnProps = PropertiesUtil.deepCopy(props); @@ -1464,6 +1466,9 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(MetaDataProtocol.MIN_SYSTEM_TABLE_TIMESTAMP)); scnProps.remove(PhoenixRuntime.TENANT_ID_ATTRIB); +// during initialization fast fail when connection has issues +ConnectionQueryServicesImpl.this.config.setInt( +HConstants.HBASE_CLIENT_RETRIES_NUMBER, Math.min(2,origClientRetries)); metaConnection = new PhoenixConnection( ConnectionQueryServicesImpl.this, url, scnProps, newEmptyMetaData()); try { @@ -1482,6 +1487,8 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement } catch (SQLException e) { sqlE = e; } finally { +ConnectionQueryServicesImpl.this.config.setInt( +HConstants.HBASE_CLIENT_RETRIES_NUMBER, origClientRetries); try { if (metaConnection != null) metaConnection.close(); } catch (SQLException e) {