Skip to content

Commit

Permalink
PHOENIX-6660 Ship reload4j in queryserver assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
stoty committed Mar 16, 2022
1 parent 78f9a1f commit 5d24015
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 16 deletions.
11 changes: 6 additions & 5 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ By default, this tarball does not contain a Phoenix client jar as it is meant to
of Phoenix version (one PQS release can be used against any Phoenix version). Today, PQS builds against
the Phoenix 5.1.1 release with HBase 2.4.2.

In order to use Phoenix Query Server, you need to copy the phoenix-client-embedded jar appropriate
for your cluster into the Queryserver root directory.

Note that the resulting Query Server binaries are not tied to any Phoenix, Hbase or Hadoop versions,
and will work with all recent Phoenix versions.
The current release requires at least Phoenix 4.16.0 or 5.1.0.

```
$ mvn clean package
Expand All @@ -41,12 +44,10 @@ $ mvn clean package
To build a release of PQS which packages a specific version of Phoenix, specify the `package-phoenix-client` system property
and specify the `phoenix.version` system property to indicate a specific Phoenix version, as well as
the `phoenix.client.artifactid` to choose the phoenix-client HBase variant.
You need to bundle the embedded client variant, to avoid conflicts with the logging libraries.

```
$ mvn clean package -Dpackage.phoenix.client -Dphoenix.version=5.1.1 -Dphoenix.client.artifactid=phoenix-client-hbase-2.4 -pl '!phoenix-queryserver-it'
```
```
$ mvn clean package -Dpackage.phoenix.client -Dphoenix.version=4.15.0-HBase-1.4 -Dphoenix.client.artifactid=phoenix-client -pl '!phoenix-queryserver-it'
$ mvn clean package -Dpackage.phoenix.client -Dphoenix.version=5.1.1 -Dphoenix.client.artifactid=phoenix-client-embedded-hbase-2.4 -pl '!phoenix-queryserver-it'
```

### Running integration tests
Expand Down
11 changes: 9 additions & 2 deletions bin/phoenix_queryserver_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def setPath():
PHOENIX_QUERYSERVER_JAR_PATTERN = "phoenix-queryserver-[!c]*.jar"
PHOENIX_LOADBALANCER_JAR_PATTERN = "load-balancer-*[!t][!e][!s][!t][!s].jar"
SQLLINE_WITH_DEPS_PATTERN = "sqlline-*-jar-with-dependencies.jar"
SLF4J_SIMPLE_JAR_PATTERN = "slf4j-simple-*[!s].jar"
SLF4J_BACKEND_JAR_PATTERN = "slf4j-reload4j-*[!s].jar"
LOGGING_JAR_PATTERN = "reload4j-*[!s].jar"

OVERRIDE_SLF4J_BACKEND = "PHOENIX_THIN_OVERRIDE_SLF4J_BACKEND"
OVERRIDE_LOGGING = "OVERRIDE_LOGGING_JAR_LOCATION"

# Backward support old env variable PHOENIX_LIB_DIR replaced by PHOENIX_CLASS_PATH
global phoenix_class_path
Expand Down Expand Up @@ -159,7 +161,12 @@ def setPath():
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_SIMPLE_JAR_PATTERN, os.path.join(current_dir, "..","lib"))
slf4j_backend_jar = findFileInPathWithoutRecursion(SLF4J_BACKEND_JAR_PATTERN, os.path.join(current_dir, "..","lib"))

global logging_jar
logging_jar = os.environ.get(OVERRIDE_LOGGING)
if logging_jar is None or logging_jar == "":
logging_jar = findFileInPathWithoutRecursion(LOGGING_JAR_PATTERN, os.path.join(current_dir, "..","lib"))

return ""

Expand Down
8 changes: 6 additions & 2 deletions bin/queryserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,13 @@
# " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \

# The command is run through subprocess so environment variables are automatically inherited
java_cmd = '%(java)s -cp ' + hbase_conf_dir + os.pathsep + hadoop_conf_dir + os.pathsep + \
java_cmd = '%(java)s -cp ' +\
hbase_conf_dir + os.pathsep + \
hadoop_conf_dir + os.pathsep + \
phoenix_queryserver_utils.slf4j_backend_jar + os.pathsep + \
phoenix_queryserver_utils.logging_jar + os.pathsep + \
phoenix_queryserver_utils.phoenix_client_jar + os.pathsep + \
phoenix_queryserver_utils.phoenix_queryserver_jar + os.pathsep + \
phoenix_queryserver_utils.phoenix_queryserver_jar + \
" -Dproc_phoenixserver" + \
" -Dlog4j.configuration=file:" + os.path.join(phoenix_queryserver_utils.current_dir, "log4j.properties") + \
" -Dpsql.root.logger=%(root_logger)s" + \
Expand Down
8 changes: 5 additions & 3 deletions bin/sqlline-thin.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ def get_spnego_auth_disabled():
jdbc_url += ';authentication=SPNEGO'

java_cmd = java + ' $PHOENIX_OPTS ' + \
' -cp "' + phoenix_queryserver_utils.sqlline_with_deps_jar \
+ os.pathsep + phoenix_queryserver_utils.phoenix_thin_client_jar + \
os.pathsep + phoenix_queryserver_utils.slf4j_backend_jar + '" -Dlog4j.configuration=file:' + \
' -cp "' + phoenix_queryserver_utils.sqlline_with_deps_jar + os.pathsep + \
phoenix_queryserver_utils.phoenix_thin_client_jar + os.pathsep + \
phoenix_queryserver_utils.slf4j_backend_jar + os.pathsep + \
phoenix_queryserver_utils.logging_jar +\
'" -Dlog4j.configuration=file:' + \
os.path.join(phoenix_queryserver_utils.current_dir, "log4j.properties") + \
' -Djavax.security.auth.useSubjectCredsOnly=false ' + \
disable_jna + \
Expand Down
7 changes: 5 additions & 2 deletions phoenix-queryserver-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
<artifactId>slf4j-reload4j</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
</dependency>
</dependencies>

Expand Down
9 changes: 8 additions & 1 deletion phoenix-queryserver-assembly/src/assembly/cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@
<unpack>false</unpack>
<outputDirectory>phoenix-queryserver-${project.parent.version}/lib</outputDirectory>
<includes>
<include>org.slf4j:slf4j-simple</include>
<include>org.slf4j:slf4j-reload4j</include>
</includes>
</dependencySet>
<dependencySet>
<unpack>false</unpack>
<outputDirectory>phoenix-queryserver-${project.parent.version}/lib</outputDirectory>
<includes>
<include>ch.qos.reload4j:reload4j</include>
</includes>
</dependencySet>
</dependencySets>
Expand Down
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
<commons-io.version>2.11.0</commons-io.version>
<commons-collections.version>3.2.2</commons-collections.version>
<sqlline.version>1.9.0</sqlline.version>
<slf4j.version>1.7.30</slf4j.version>
<slf4j.version>1.7.36</slf4j.version>
<reload4j.version>1.2.19</reload4j.version>
<avatica.version>1.19.0</avatica.version>
<servlet.api.version>3.1.0</servlet.api.version>
<jsr305.version>3.0.0</jsr305.version>
Expand Down Expand Up @@ -564,6 +565,16 @@
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.reload4j</groupId>
<artifactId>reload4j</artifactId>
<version>${reload4j.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.argparse4j</groupId>
<artifactId>argparse4j</artifactId>
Expand Down

0 comments on commit 5d24015

Please sign in to comment.