From ef98161ce21950f3ee81e72505e3cfda6697e330 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Sat, 2 Apr 2022 12:09:09 +0300 Subject: [PATCH] [Pulsar SQL] Add workaround for Presto 332 java.version parsing issue - Presto 332 cannot parse a version string with more than 2 dots, such as 11.0.14.1 - Add a workaround that overrides the java.version system property with a version with 2 dots in it. --- .github/workflows/pulsar-ci.yaml | 10 +++++++--- bin/pulsar | 13 +++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pulsar-ci.yaml b/.github/workflows/pulsar-ci.yaml index a3ec2a6c1c893..3a372134fcc5c 100644 --- a/.github/workflows/pulsar-ci.yaml +++ b/.github/workflows/pulsar-ci.yaml @@ -556,6 +556,11 @@ jobs: -Pmain,docker -Dmaven.test.skip=true -Ddockerfile.build.squash=true \ -Dspotbugs.skip=true -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true + # Checks also Presto license files + - name: Check binary licenses + if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }} + run: src/check-binary-license.sh ./distribution/server/target/apache-pulsar-*-bin.tar.gz + - name: save docker image apachepulsar/pulsar-test-latest-version:latest to Github artifact cache if: ${{ needs.changed_files_job.outputs.docs_only != 'true' }} run: | @@ -604,9 +609,8 @@ jobs: - name: Pulsar IO - Oracle group: PULSAR_IO_ORA - # disable Sql integration tests until https://github.com/apache/pulsar/issues/14951 has been resolved - #- name: Sql - # group: SQL + - name: Sql + group: SQL steps: - name: checkout diff --git a/bin/pulsar b/bin/pulsar index 43e137af5317a..1e52a22862ea6 100755 --- a/bin/pulsar +++ b/bin/pulsar @@ -126,6 +126,15 @@ check_presto_libraries() { fi } +presto_java11_workaround() { + local prefix="${1:-"-D"}" + # workaround https://github.com/apache/pulsar/issues/14951 + local java_version_trimmed=$({ $JAVA -version 2>&1| head -1 | awk -F\" '{ print $2 }' | awk -F. '{ print $1 "." $2 "." $3 }' | grep -v -F ..; } 2>/dev/null) + if [ -n "$java_version_trimmed" ]; then + echo "${prefix}java.version=${java_version_trimmed}" + fi +} + pulsar_help() { cat < @@ -371,10 +380,10 @@ elif [ $COMMAND == "compact-topic" ]; then exec $JAVA $OPTS org.apache.pulsar.compaction.CompactorTool --broker-conf $PULSAR_BROKER_CONF $@ elif [ $COMMAND == "sql" ]; then check_presto_libraries - exec $JAVA -cp "${PRESTO_HOME}/lib/*" io.prestosql.cli.Presto --server localhost:8081 "${@}" + exec $JAVA -cp "${PRESTO_HOME}/lib/*" $(presto_java11_workaround) io.prestosql.cli.Presto --server localhost:8081 "${@}" elif [ $COMMAND == "sql-worker" ]; then check_presto_libraries - exec ${PRESTO_HOME}/bin/launcher --etc-dir ${PULSAR_PRESTO_CONF} "${@}" + exec ${PRESTO_HOME}/bin/launcher $(presto_java11_workaround "-D ") --etc-dir ${PULSAR_PRESTO_CONF} "${@}" elif [ $COMMAND == "tokens" ]; then exec $JAVA $OPTS org.apache.pulsar.utils.auth.tokens.TokensCliUtils $@ elif [ $COMMAND == "version" ]; then