You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ri...@apache.org on 2021/06/08 09:26:42 UTC

[phoenix] branch 4.x updated: PHOENIX-6378 Unbunldle sqqline from phoenix-client-embedded, and use it in sqlline.py

This is an automated email from the ASF dual-hosted git repository.

richardantal pushed a commit to branch 4.x
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x by this push:
     new eb8a91e  PHOENIX-6378 Unbunldle sqqline from phoenix-client-embedded, and use it in sqlline.py
eb8a91e is described below

commit eb8a91ed25489b880ffa34310f741a83316c97fb
Author: Richard Antal <an...@gmail.com>
AuthorDate: Mon May 31 10:32:41 2021 +0200

    PHOENIX-6378 Unbunldle sqqline from phoenix-client-embedded, and use it in sqlline.py
    
    Change-Id: Ifd31e25b303ab3d2872b53f4a503219539777544
---
 bin/phoenix_utils.py                               | 43 +++++++++++++++-------
 bin/sqlline.py                                     |  4 +-
 phoenix-assembly/pom.xml                           | 10 +++++
 .../build/components/all-common-dependencies.xml   | 30 +++++++++++++++
 .../src/build/components/all-common-jars.xml       |  7 ++++
 phoenix-assembly/src/build/package-to-tar-all.xml  | 12 ++++++
 .../phoenix-client-embedded/pom.xml                |  4 --
 pom.xml                                            | 22 ++++++++++-
 8 files changed, 112 insertions(+), 20 deletions(-)

diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 126139d..d5cfab6 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -77,10 +77,16 @@ def findClasspath(command_name):
     return tryDecode(subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read())
 
 def setPath():
-    PHOENIX_CLIENT_JAR_PATTERN = "phoenix-client-hbase-*[!s].jar"
+    PHOENIX_CLIENT_EMBEDDED_JAR_PATTERN = "phoenix-client-embedded-hbase-*[!s].jar"
     PHOENIX_TRACESERVER_JAR_PATTERN = "phoenix-tracing-webapp-*-runnable.jar"
     PHOENIX_TESTS_JAR_PATTERN = "phoenix-core-*-tests*.jar"
     PHOENIX_PHERF_JAR_PATTERN = "phoenix-pherf-*[!s].jar"
+    SLF4J_LOG4J12_JAR_PATTERN = "slf4j-log4j12-*[!s].jar"
+    SQLLINE_WITH_DEPS_PATTERN = "sqlline-*-jar-with-dependencies.jar"
+
+
+    OVERRIDE_SLF4J_BACKEND = "OVERRIDE_SLF4J_BACKEND_JAR_LOCATION"
+    OVERRIDE_SQLLINE = "OVERRIDE_SQLLINE_JAR_LOCATION"
 
     # Backward support old env variable PHOENIX_LIB_DIR replaced by PHOENIX_CLASS_PATH
     global phoenix_class_path
@@ -113,15 +119,15 @@ def setPath():
     if pherf_properties_file == "":
         pherf_conf_path = os.path.join(current_dir, "..", "phoenix-pherf", "config")
 
-    global phoenix_jar_path
-    phoenix_jar_path = os.path.join(current_dir, "..", "phoenix-client-parent" , "phoenix-client", "target","*")
+    global phoenix_embedded_jar_path
+    phoenix_embedded_jar_path = os.path.join(current_dir, "..", "phoenix-client-parent" , "phoenix-client-embedded", "target","*")
 
-    global phoenix_client_jar
-    phoenix_client_jar = find(PHOENIX_CLIENT_JAR_PATTERN, phoenix_jar_path)
-    if phoenix_client_jar == "":
-        phoenix_client_jar = findFileInPathWithoutRecursion(PHOENIX_CLIENT_JAR_PATTERN, os.path.join(current_dir, ".."))
-    if phoenix_client_jar == "":
-        phoenix_client_jar = find(PHOENIX_CLIENT_JAR_PATTERN, phoenix_class_path)
+    global phoenix_client_embedded_jar
+    phoenix_client_embedded_jar = find(PHOENIX_CLIENT_EMBEDDED_JAR_PATTERN, phoenix_embedded_jar_path)
+    if phoenix_client_embedded_jar == "":
+        phoenix_client_embedded_jar = findFileInPathWithoutRecursion(PHOENIX_CLIENT_EMBEDDED_JAR_PATTERN, os.path.join(current_dir, ".."))
+    if phoenix_client_embedded_jar == "":
+        phoenix_client_embedded_jar = find(PHOENIX_CLIENT_EMBEDDED_JAR_PATTERN, phoenix_class_path)
 
     global phoenix_test_jar_path
     phoenix_test_jar_path = os.path.join(current_dir, "..", "phoenix-core", "target","*")
@@ -176,6 +182,16 @@ def setPath():
     if phoenix_pherf_jar == "":
         phoenix_pherf_jar = findFileInPathWithoutRecursion(PHOENIX_PHERF_JAR_PATTERN, os.path.join(current_dir, ".."))
 
+    global sqlline_with_deps_jar
+    sqlline_with_deps_jar = os.environ.get(OVERRIDE_SQLLINE)
+    if sqlline_with_deps_jar is None or sqlline_with_deps_jar == "":
+        sqlline_with_deps_jar = findFileInPathWithoutRecursion(SQLLINE_WITH_DEPS_PATTERN, os.path.join(current_dir, "..","lib"))
+
+    global slf4j_backend_jar
+    slf4j_backend_jar = os.environ.get(OVERRIDE_SLF4J_BACKEND)
+    if slf4j_backend_jar is None or slf4j_backend_jar == "":
+        slf4j_backend_jar = findFileInPathWithoutRecursion(SLF4J_LOG4J12_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
+
     return ""
 
 def shell_quote(args):
@@ -204,15 +220,14 @@ if __name__ == "__main__":
     print("hbase_conf_dir:", hbase_conf_dir)
     print("hbase_conf_path:", hbase_conf_path)
     print("current_dir:", current_dir)
-    print("phoenix_jar_path:", phoenix_jar_path)
-    print("phoenix_client_jar:", phoenix_client_jar)
+    print("phoenix_embedded_jar_path:", phoenix_embedded_jar_path)
+    print("phoenix_client_embedded_jar:", phoenix_client_embedded_jar)
     print("phoenix_test_jar_path:", phoenix_test_jar_path)
     print("hadoop_common_jar_path:", hadoop_common_jar_path)
     print("hadoop_common_jar:", hadoop_common_jar)
     print("hadoop_hdfs_jar_path:", hadoop_hdfs_jar_path)
     print("hadoop_hdfs_jar:", hadoop_hdfs_jar)
     print("testjar:", testjar)
-    print("phoenix_queryserver_jar:", phoenix_queryserver_jar)
-    print("phoenix_loadbalancer_jar:", phoenix_loadbalancer_jar)
-    print("phoenix_thin_client_jar:", phoenix_thin_client_jar)
     print("hadoop_classpath:", hadoop_classpath)
+    print("sqlline_with_deps_jar:", sqlline_with_deps_jar)
+    print("slf4j_backend_jar:", slf4j_backend_jar)
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 23e54c5..be0637d 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -108,7 +108,9 @@ if os.name == 'nt':
     colorSetting = "false"
 
 java_cmd = java + ' $PHOENIX_OPTS ' + \
-    ' -cp "' + hbase_config_path + os.pathsep + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_jar + \
+    ' -cp "' + phoenix_utils.sqlline_with_deps_jar + os.pathsep + hbase_config_path + os.pathsep + \
+    phoenix_utils.slf4j_backend_jar + os.pathsep + \
+    phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_utils.phoenix_client_embedded_jar + \
     os.pathsep + phoenix_utils.hadoop_common_jar + os.pathsep + phoenix_utils.hadoop_hdfs_jar + \
     os.pathsep + phoenix_utils.hadoop_conf + os.pathsep + phoenix_utils.hadoop_classpath + '" -Dlog4j.configuration=file:' + \
     os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index e295cbb..b7e07d2 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -134,6 +134,10 @@
     </dependency>
     <dependency>
       <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-client-embedded-${hbase.suffix}</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.phoenix</groupId>
       <artifactId>phoenix-pherf</artifactId>
     </dependency>
     <dependency>
@@ -145,5 +149,11 @@
       <artifactId>omid-hbase-tools-hbase1.x</artifactId>
       <version>${omid.version}</version>
     </dependency>
+    <dependency>
+      <groupId>sqlline</groupId>
+      <artifactId>sqlline</artifactId>
+      <version>${sqlline.version}</version>
+      <classifier>jar-with-dependencies</classifier>
+    </dependency>
   </dependencies>
 </project>
diff --git a/phoenix-assembly/src/build/components/all-common-dependencies.xml b/phoenix-assembly/src/build/components/all-common-dependencies.xml
new file mode 100644
index 0000000..5381c88
--- /dev/null
+++ b/phoenix-assembly/src/build/components/all-common-dependencies.xml
@@ -0,0 +1,30 @@
+<?xml version='1.0'?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<component>
+  <!-- All of our dependencies -->
+  <dependencySets>
+    <dependencySet>
+      <unpack>false</unpack>
+      <outputDirectory>/lib</outputDirectory>
+      <includes>
+        <include>sqlline:sqlline:jar:jar-with-dependencies</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+</component>
\ No newline at end of file
diff --git a/phoenix-assembly/src/build/components/all-common-jars.xml b/phoenix-assembly/src/build/components/all-common-jars.xml
index a7b3a34..d75915a 100644
--- a/phoenix-assembly/src/build/components/all-common-jars.xml
+++ b/phoenix-assembly/src/build/components/all-common-jars.xml
@@ -31,6 +31,13 @@
       </includes>
     </fileSet>
     <fileSet>
+      <directory>${project.basedir}/../phoenix-client-parent/phoenix-client-embedded/target</directory>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>phoenix-client-embedded-${hbase.suffix}-${project.version}.jar</include>
+      </includes>
+    </fileSet>
+    <fileSet>
       <directory>${project.basedir}/../phoenix-server/target</directory>
       <outputDirectory>/</outputDirectory>
       <includes>
diff --git a/phoenix-assembly/src/build/package-to-tar-all.xml b/phoenix-assembly/src/build/package-to-tar-all.xml
index fa945f8..f64ace9 100644
--- a/phoenix-assembly/src/build/package-to-tar-all.xml
+++ b/phoenix-assembly/src/build/package-to-tar-all.xml
@@ -30,8 +30,20 @@
   </formats>
   <includeBaseDirectory>true</includeBaseDirectory>
 
+  <!-- Components that we don't want in jars that are used with other libraries, but we want for a standalone client -->
+  <dependencySets>
+    <dependencySet>
+      <unpack>false</unpack>
+      <outputDirectory>/lib</outputDirectory>
+      <includes>
+        <include>org.slf4j:slf4j-log4j12</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+
   <componentDescriptors>
     <componentDescriptor>src/build/components/all-common-jars.xml</componentDescriptor>
     <componentDescriptor>src/build/components/all-common-files.xml</componentDescriptor>
+    <componentDescriptor>src/build/components/all-common-dependencies.xml</componentDescriptor>
   </componentDescriptors>
 </assembly>
\ No newline at end of file
diff --git a/phoenix-client-parent/phoenix-client-embedded/pom.xml b/phoenix-client-parent/phoenix-client-embedded/pom.xml
index 0536dd8..b487027 100644
--- a/phoenix-client-parent/phoenix-client-embedded/pom.xml
+++ b/phoenix-client-parent/phoenix-client-embedded/pom.xml
@@ -82,10 +82,6 @@
       <artifactId>phoenix-hbase-compat-${hbase.compat.version}</artifactId>
       <optional>false</optional>
     </dependency>
-    <dependency>
-      <groupId>sqlline</groupId>
-      <artifactId>sqlline</artifactId>
-    </dependency>
   </dependencies>
 
 </project>
diff --git a/pom.xml b/pom.xml
index 408954c..86a50c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -588,7 +588,27 @@
       </dependency>
       <dependency>
         <groupId>org.apache.phoenix</groupId>
-        <artifactId>phoenix-server-hbase-1.3</artifactId>
+        <artifactId>phoenix-client-embedded-hbase-1.3</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.phoenix</groupId>
+        <artifactId>phoenix-client-embedded-hbase-1.4</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.phoenix</groupId>
+        <artifactId>phoenix-client-embedded-hbase-1.5</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.phoenix</groupId>
+        <artifactId>phoenix-client-embedded-hbase-1.6</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.phoenix</groupId>
+        <artifactId>phoenix-server-hbase-2.1</artifactId>
         <version>${project.version}</version>
       </dependency>
       <dependency>