Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build][sql] Make pulsar-trino-disto self-contained #17062

Merged
merged 27 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
21c1164
[build][sql] Make trino disto self-contained
tisonkun Aug 11, 2022
60d8579
checkstyle LineLength only for Java files
tisonkun Aug 11, 2022
a3454a6
update related refs
tisonkun Aug 11, 2022
fa875a7
fix relpath
tisonkun Aug 11, 2022
b15ebbe
Merge branch 'master' into trino-disto-self-contain
tisonkun Aug 20, 2022
e250496
Merge branch 'master' into trino-disto-self-contain
tisonkun Aug 25, 2022
7ae043f
lib/presto to trino
tisonkun Aug 25, 2022
9c59029
more lib/presto to trino
tisonkun Aug 25, 2022
c2f605e
avoid generate dir to reduce target space occupation
tisonkun Aug 25, 2022
cb16fc4
Merge branch 'master' into trino-disto-self-contain
tisonkun Aug 29, 2022
0425513
Merge branch 'master' into trino-disto-self-contain
tisonkun Aug 29, 2022
530b857
Merge branch 'master' into trino-disto-self-contain
tisonkun Aug 29, 2022
093c840
Merge branch 'master' into trino-disto-self-contain
tisonkun Aug 31, 2022
43c8c7d
fallback to previous directory
tisonkun Aug 31, 2022
362207d
fix and fallback to previous variable name
tisonkun Aug 31, 2022
54fb61e
revert fallback internal folder
tisonkun Aug 31, 2022
f059c6a
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 2, 2022
a05e737
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 2, 2022
8e2a497
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 2, 2022
2709a9d
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 3, 2022
8522975
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 4, 2022
4fd524d
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 5, 2022
f5b575d
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 5, 2022
c32eea9
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 7, 2022
52c486a
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 7, 2022
0e80e3a
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 9, 2022
10f7209
Merge branch 'master' into trino-disto-self-contain
tisonkun Sep 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-owasp-dep-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
docker rmi $(docker images -q) -f
df -h

# Projects dependent on flume, hdfs, hbase, and presto currently excluded from the scan.
# Projects dependent on flume, hdfs, hbase, and trino currently excluded from the scan.
- name: run "clean verify" to trigger dependency check
if: ${{ steps.changes.outputs.poms == 'true' }}
run: mvn -q -B -ntp clean verify -PskipDocker,owasp-dependency-check -DskipTests -pl '!pulsar-sql,!distribution/io,!distribution/offloaders,!tiered-storage/file-system,!pulsar-io/flume,!pulsar-io/hbase,!pulsar-io/hdfs2,!pulsar-io/hdfs3,!pulsar-io/docs,!pulsar-io/jdbc/openmldb'
Expand Down
45 changes: 28 additions & 17 deletions bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ DEFAULT_PROXY_CONF=$PULSAR_HOME/conf/proxy.conf
DEFAULT_STANDALONE_CONF=$PULSAR_HOME/conf/standalone.conf
DEFAULT_WEBSOCKET_CONF=$PULSAR_HOME/conf/websocket.conf
DEFAULT_LOG_CONF=$PULSAR_HOME/conf/log4j2.yaml
DEFAULT_PULSAR_PRESTO_CONF=${PULSAR_HOME}/conf/presto
DEFAULT_FUNCTIONS_LOG_CONF=$PULSAR_HOME/conf/functions_log4j2.xml

# functions related variables
Expand All @@ -46,7 +45,8 @@ PY_INSTANCE_FILE=${PULSAR_PY_INSTANCE_FILE:-"${DEFAULT_PY_INSTANCE_FILE}"}
DEFAULT_FUNCTIONS_EXTRA_DEPS_DIR=$PULSAR_HOME/instances/deps
FUNCTIONS_EXTRA_DEPS_DIR=${PULSAR_FUNCTIONS_EXTRA_DEPS_DIR:-"${DEFAULT_FUNCTIONS_EXTRA_DEPS_DIR}"}
SQL_HOME=$PULSAR_HOME/pulsar-sql
PRESTO_HOME=${PULSAR_HOME}/lib/presto
TRINO_HOME=${PULSAR_HOME}/trino
DEFAULT_PULSAR_TRINO_CONF=${TRINO_HOME}/conf

pulsar_help() {
cat <<EOF
Expand Down Expand Up @@ -90,7 +90,7 @@ Environment variables:
PULSAR_PROXY_CONF Configuration file for Pulsar proxy (default: $DEFAULT_PROXY_CONF)
PULSAR_WORKER_CONF Configuration file for functions worker (default: $DEFAULT_WORKER_CONF)
PULSAR_STANDALONE_CONF Configuration file for standalone (default: $DEFAULT_STANDALONE_CONF)
PULSAR_PRESTO_CONF Configuration directory for Pulsar Presto (default: $DEFAULT_PULSAR_PRESTO_CONF)
PULSAR_TRINO_CONF Configuration directory for Pulsar SQL (default: $DEFAULT_PULSAR_TRINO_CONF)
PULSAR_EXTRA_OPTS Extra options to be passed to the jvm
PULSAR_EXTRA_CLASSPATH Add extra paths to the pulsar classpath
PULSAR_PID_DIR Folder where the pulsar server PID file should be stored
Expand Down Expand Up @@ -177,17 +177,17 @@ if [ ! -f "${PY_INSTANCE_FILE}" ]; then
PY_INSTANCE_FILE=${BUILT_PY_INSTANCE_FILE}
fi

# find pulsar sql presto distribution location
check_presto_libraries() {
if [ ! -d "${PRESTO_HOME}" ]; then

BUILT_PRESTO_HOME="${SQL_HOME}/presto-distribution/target/pulsar-presto-distribution"
if [ ! -d "${BUILT_PRESTO_HOME}" ]; then
echo "\nCouldn't find presto distribution.";
# find pulsar sql trino distribution location
check_trino_libraries() {
if [ ! -d "${TRINO_HOME}" ]; then
BUILT_TRINO_HOME="${SQL_HOME}/presto-distribution/target/pulsar-presto-distribution"
if [ ! -d "${BUILT_TRINO_HOME}" ]; then
echo "\nCouldn't find trino distribution.";
echo "Make sure you've run 'mvn package'\n";
exit 1;
fi
PRESTO_HOME=${BUILT_PRESTO_HOME}
TRINO_HOME=${BUILT_TRINO_HOME}
PULSAR_TRINO_CONF=${BUILT_TRINO_HOME}/conf
fi
}

Expand Down Expand Up @@ -257,8 +257,19 @@ if [ -z "$PULSAR_LOG_CONF" ]; then
PULSAR_LOG_CONF=$DEFAULT_LOG_CONF
fi

if [ -z "$PULSAR_PRESTO_CONF" ]; then
PULSAR_PRESTO_CONF=$DEFAULT_PULSAR_PRESTO_CONF
if [ -z "$PULSAR_TRINO_CONF" ]; then
# TODO: As PIP-200 accepted, this compatibility is not promised. Refactor when we drop this b/w compatibility.
if [ -z "$PULSAR_PRESTO_CONF" ]; then
PULSAR_TRINO_CONF=$DEFAULT_PULSAR_TRINO_CONF
else
PULSAR_TRINO_CONF=$PULSAR_PRESTO_CONF
fi
if [ ! -d "${PULSAR_TRINO_CONF}" ]; then
FALLBACK_PULSAR_PRESTO_CONF=${PULSAR_HOME}/conf/presto
if [ -d "${FALLBACK_PULSAR_PRESTO_CONF}" ]; then
PULSAR_TRINO_CONF=$FALLBACK_PULSAR_PRESTO_CONF
fi
fi
fi

if [ -z "$FUNCTIONS_LOG_CONF"]; then
Expand Down Expand Up @@ -387,11 +398,11 @@ elif [ $COMMAND == "broker-tool" ]; then
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.trino.cli.Trino --server localhost:8081 "${@}"
check_trino_libraries
exec $JAVA -cp "${TRINO_HOME}/lib/*" io.trino.cli.Trino --server localhost:8081 "${@}"
elif [ $COMMAND == "sql-worker" ]; then
check_presto_libraries
exec python3 ${PRESTO_HOME}/bin/launcher.py --etc-dir ${PULSAR_PRESTO_CONF} "${@}"
check_trino_libraries
exec python3 ${TRINO_HOME}/bin/launcher.py --etc-dir ${PULSAR_TRINO_CONF} "${@}"
elif [ $COMMAND == "tokens" ]; then
exec $JAVA $OPTS org.apache.pulsar.utils.auth.tokens.TokensCliUtils $@
elif [ $COMMAND == "version" ]; then
Expand Down
4 changes: 2 additions & 2 deletions distribution/server/src/assemble/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@
</fileSet>
<fileSet>
<directory>${basedir}/../../pulsar-sql/presto-distribution/target/pulsar-presto-distribution</directory>
<outputDirectory>lib/presto</outputDirectory>
<outputDirectory>trino</outputDirectory>
<excludes>
<exclude>bin</exclude>
<exclude>bin/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${basedir}/../../pulsar-sql/presto-distribution/target/pulsar-presto-distribution</directory>
<outputDirectory>lib/presto</outputDirectory>
<outputDirectory>trino</outputDirectory>
<includes>
<include>bin/**</include>
</includes>
Expand Down
2 changes: 1 addition & 1 deletion docker-compose/kitchen-sink/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ services:
image: apachepulsar/pulsar-all:latest
restart: on-failure
command: >
bash -c "bin/apply-config-from-env-with-prefix.py SQL_PREFIX_ conf/presto/catalog/pulsar.properties && \
bash -c "bin/apply-config-from-env-with-prefix.py SQL_PREFIX_ trino/conf/catalog/pulsar.properties && \
bin/apply-config-from-env.py conf/pulsar_env.sh && \
bin/watch-znode.py -z $$zookeeperServers -p /initialized-$$clusterName -w && \
exec bin/pulsar sql-worker run"
Expand Down
6 changes: 3 additions & 3 deletions docker/pulsar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ RUN for SUBDIRECTORY in conf data download logs; do \
chmod -R g+w /pulsar/$SUBDIRECTORY; \
done

# Presto writes logs to this directory (at least during tests), so we need to give the process permission
# to create those log directories. This should be removed when presto is removed.
RUN chmod g+w /pulsar/lib/presto
# Trino writes logs to this directory (at least during tests), so we need to give the process permission
# to create those log directories. This should be removed when Trino is removed.
RUN chmod g+w /pulsar/trino

### Create 2nd stage from Ubuntu image
### and add OpenJDK and Python dependencies (for Pulsar functions)
Expand Down
4 changes: 4 additions & 0 deletions pulsar-sql/presto-distribution/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<directory>${basedir}/../presto-pulsar-plugin/target/pulsar-presto-connector/</directory>
<outputDirectory>plugin/</outputDirectory>
</fileSet>
<fileSet>
<directory>${basedir}/src/main/resources/conf/</directory>
<outputDirectory>conf/</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions src/check-binary-license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if [ -z $TARBALL ]; then
exit 1
fi

JARS=$(tar -tf $TARBALL | grep '\.jar' | grep -v 'lib/presto/' | grep -v '/examples/' | grep -v '/instances/' | sed 's!.*/!!' | sort)
JARS=$(tar -tf $TARBALL | grep '\.jar' | grep -v 'trino/' | grep -v '/examples/' | grep -v '/instances/' | sed 's!.*/!!' | sort)

LICENSEPATH=$(tar -tf $TARBALL | awk '/^[^\/]*\/LICENSE/')
LICENSE=$(tar -O -xf $TARBALL "$LICENSEPATH")
Expand Down Expand Up @@ -96,7 +96,7 @@ done

if [ "$NO_PRESTO" -ne 1 ]; then
# check pulsar sql jars
JARS=$(tar -tf $TARBALL | grep '\.jar' | grep 'lib/presto/' | grep -v pulsar-client | grep -v bouncy-castle-bc | grep -v pulsar-metadata | grep -v 'managed-ledger' | grep -v 'pulsar-client-admin' | grep -v 'pulsar-client-api' | grep -v 'pulsar-functions-api' | grep -v 'pulsar-presto-connector-original' | grep -v 'pulsar-presto-distribution' | grep -v 'pulsar-common' | grep -v 'pulsar-functions-proto' | grep -v 'pulsar-functions-utils' | grep -v 'pulsar-io-core' | grep -v 'pulsar-transaction-common' | grep -v 'pulsar-package-core' | sed 's!.*/!!' | sort)
JARS=$(tar -tf $TARBALL | grep '\.jar' | grep 'trino/' | grep -v pulsar-client | grep -v bouncy-castle-bc | grep -v pulsar-metadata | grep -v 'managed-ledger' | grep -v 'pulsar-client-admin' | grep -v 'pulsar-client-api' | grep -v 'pulsar-functions-api' | grep -v 'pulsar-presto-connector-original' | grep -v 'pulsar-presto-distribution' | grep -v 'pulsar-common' | grep -v 'pulsar-functions-proto' | grep -v 'pulsar-functions-utils' | grep -v 'pulsar-io-core' | grep -v 'pulsar-transaction-common' | grep -v 'pulsar-package-core' | sed 's!.*/!!' | sort)
if [ -n "$JARS" ]; then
LICENSEPATH=$(tar -tf $TARBALL | awk '/^[^\/]*\/lib\/presto\/LICENSE/')
LICENSE=$(tar -O -xf $TARBALL "$LICENSEPATH")
Expand All @@ -111,7 +111,7 @@ if [ "$NO_PRESTO" -ne 1 ]; then

echo "$LICENSE" | grep -q $J
if [ $? != 0 ]; then
echo $J unaccounted for in lib/presto/LICENSE
echo $J unaccounted for in trino/LICENSE
EXIT=1
fi
done
Expand All @@ -120,7 +120,7 @@ if [ "$NO_PRESTO" -ne 1 ]; then
for J in $LICENSEJARS; do
echo "$JARS" | grep -q $J
if [ $? != 0 ]; then
echo $J mentioned in lib/presto/LICENSE, but not bundled
echo $J mentioned in trino/LICENSE, but not bundled
EXIT=2
fi
done
Expand Down
2 changes: 1 addition & 1 deletion tests/docker-images/latest-version-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ COPY scripts/init-cluster.sh scripts/run-global-zk.sh scripts/run-local-zk.sh \
scripts/run-standalone.sh \
/pulsar/bin/

COPY conf/presto/jvm.config /pulsar/conf/presto/
COPY conf/presto/jvm.config /pulsar/trino/conf

# copy python test examples
RUN mkdir -p /pulsar/instances/deps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# under the License.
#

bin/apply-config-from-env-with-prefix.py SQL_PREFIX_ conf/presto/catalog/pulsar.properties && \
bin/apply-config-from-env-with-prefix.py SQL_PREFIX_ trino/conf/catalog/pulsar.properties && \
bin/apply-config-from-env.py conf/pulsar_env.sh

if [ -z "$NO_AUTOSTART" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public PrestoWorkerContainer(String clusterName, String hostname) {
@Override
protected void afterStart() {
DockerUtils.runCommandAsyncWithLogging(this.dockerClient, this.getContainerId(),
"tail", "-f", "/pulsar/lib/presto/var/log/launcher.log");
"tail", "-f", "/pulsar/trino/var/log/launcher.log");
DockerUtils.runCommandAsyncWithLogging(this.dockerClient, this.getContainerId(),
"tail", "-f", "/var/log/pulsar/presto_worker.log");
DockerUtils.runCommandAsyncWithLogging(this.dockerClient, this.getContainerId(),
"tail", "-f", "/pulsar/lib/presto/var/log/server.log");
"tail", "-f", "/pulsar/trino/var/log/server.log");
}

@Override
Expand All @@ -57,7 +57,7 @@ protected void beforeStop() {
DockerUtils.dumpContainerDirToTargetCompressed(
getDockerClient(),
getContainerId(),
"/pulsar/lib/presto/var/log"
"/pulsar/trino/var/log"
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ private PrestoWorkerContainer buildPrestoWorkerContainer(String hostName, boolea
.withEnv("pulsar.web-service-url", "http://pulsar-broker-0:8080")
.withEnv("SQL_PREFIX_pulsar.max-message-size", "" + spec.maxMessageSize)
.withClasspathResourceMapping(
resourcePath, "/pulsar/conf/presto/config.properties", BindMode.READ_WRITE);
resourcePath, "/pulsar/trino/conf/config.properties", BindMode.READ_WRITE);
if (spec.queryLastMessage) {
container.withEnv("pulsar.bookkeeper-use-v2-protocol", "false")
.withEnv("pulsar.bookkeeper-explicit-interval", "10");
Expand Down