This is an automated email from the ASF dual-hosted git repository.
capistrant pushed a commit to branch 34.0.0
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/34.0.0 by this push:
new cd86d822778 Remove the hardcoded `MYSQL_DRIVER_CLASSNAME` from
Dockerfile, build script now is responsible to make sure it's non-empty.
(#18279) (#18285)
cd86d822778 is described below
commit cd86d822778a50ea928eb54e919e575cd71627b5
Author: Lucas Capistrant <[email protected]>
AuthorDate: Fri Jul 18 13:14:44 2025 -0500
Remove the hardcoded `MYSQL_DRIVER_CLASSNAME` from Dockerfile, build script
now is responsible to make sure it's non-empty. (#18279) (#18285)
* some docker image change
* delete run-mysql
Co-authored-by: Cece Mei <[email protected]>
---
integration-tests/docker/Dockerfile | 32 ++++++++++++++--------
integration-tests/docker/base-setup.sh | 2 +-
integration-tests/docker/druid.sh | 22 ++++++++++-----
integration-tests/docker/run-mysql.sh | 27 ------------------
.../service-supervisords/metadata-storage.conf | 2 +-
.../script/docker_build_containers.sh | 5 ++++
6 files changed, 42 insertions(+), 48 deletions(-)
diff --git a/integration-tests/docker/Dockerfile
b/integration-tests/docker/Dockerfile
index 9c41a41baff..896c6e9af97 100644
--- a/integration-tests/docker/Dockerfile
+++ b/integration-tests/docker/Dockerfile
@@ -30,7 +30,7 @@ RUN APACHE_ARCHIVE_MIRROR_HOST=${APACHE_ARCHIVE_MIRROR_HOST}
/root/base-setup.sh
FROM druidbase
ARG MYSQL_VERSION
ARG MARIA_VERSION
-ARG MYSQL_DRIVER_CLASSNAME=com.mysql.jdbc.Driver
+ARG MYSQL_DRIVER_CLASSNAME
ARG CONFLUENT_VERSION
# Verify Java version
@@ -44,27 +44,35 @@ COPY extensions/ /usr/local/druid/extensions/
# Download the MySQL Java connector
# target path must match the exact path referenced in
environment-configs/common
# alternatively: Download the MariaDB Java connector, and pretend it is the
mysql connector
-RUN if [ "$MYSQL_DRIVER_CLASSNAME" = "com.mysql.jdbc.Driver" ] ; \
- then wget -q
"https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/$MYSQL_VERSION/mysql-connector-j-$MYSQL_VERSION.jar"
\
- -O /usr/local/druid/lib/mysql-connector-j.jar; \
- elif [ "$MYSQL_DRIVER_CLASSNAME" = "org.mariadb.jdbc.Driver" ] ; \
- then wget -q
"https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/$MARIA_VERSION/mariadb-java-client-$MARIA_VERSION.jar"
\
- -O /usr/local/druid/lib/mysql-connector-j.jar; \
- fi
+RUN ( \
+ if [ "$MYSQL_DRIVER_CLASSNAME" = "com.mysql.jdbc.Driver" ]; then \
+ wget -q
"https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/$MYSQL_VERSION/mysql-connector-j-$MYSQL_VERSION.jar"
-O /usr/local/druid/lib/mysql-connector-j.jar; \
+ elif [ "$MYSQL_DRIVER_CLASSNAME" = "org.mariadb.jdbc.Driver" ]; then \
+ wget -q
"https://repo1.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/$MARIA_VERSION/mariadb-java-client-$MARIA_VERSION.jar"
-O /usr/local/druid/lib/mysql-connector-j.jar; \
+ else \
+ echo "Unknown MySQL driver class name: $MYSQL_DRIVER_CLASSNAME"; \
+ exit 1; \
+ fi \
+ )
# download kafka protobuf provider
RUN wget -q
"https://packages.confluent.io/maven/io/confluent/kafka-protobuf-provider/$CONFLUENT_VERSION/kafka-protobuf-provider-$CONFLUENT_VERSION.jar"
\
-O /usr/local/druid/lib/kafka-protobuf-provider.jar
# Setup metadata store
-ADD run-mysql.sh /run-mysql.sh
RUN echo "[mysqld]\ncharacter-set-server=utf8\ncollation-server=utf8_bin\n" >>
/etc/mysql/my.cnf
-RUN mkdir -p /run/mysqld && chown mysql:mysql /run/mysqld
RUN ( \
- bash /run-mysql.sh; \
+ service mariadb start; \
+ for i in {30..0}; do \
+ mysqladmin ping --silent && break; \
+ sleep 1; \
+ done; \
+ if [ "$i" = 0 ]; then \
+ echo "MySQL did not start"; exit 1; \
+ fi; \
echo "CREATE USER 'druid'@'%' IDENTIFIED BY 'diurd'; GRANT ALL ON druid.*
TO 'druid'@'%'; CREATE database druid DEFAULT CHARACTER SET utf8mb4;" | mysql
-u root; \
/usr/local/druid/bin/run-java -cp "/usr/local/druid/lib/*"
-Ddruid.extensions.directory=/usr/local/druid/extensions
-Ddruid.extensions.loadList='["mysql-metadata-storage"]'
-Ddruid.metadata.storage.type=mysql
-Ddruid.metadata.mysql.driver.driverClassName=$MYSQL_DRIVER_CLASSNAME
org.apache.druid.cli.Main tools metadata-init
--connectURI="jdbc:mysql://localhost:3306/druid" --user=druid --password=diurd;
\
- mysqladmin shutdown \
+ service mariadb stop \
)
ADD test-data /test-data
diff --git a/integration-tests/docker/base-setup.sh
b/integration-tests/docker/base-setup.sh
index 31720fcbca9..65f8a2b56d2 100755
--- a/integration-tests/docker/base-setup.sh
+++ b/integration-tests/docker/base-setup.sh
@@ -25,7 +25,7 @@ apt-get update
# wget
apt-get install -y wget
-# MySQL (Metadata store)
+# MySQL (Metadata store), modern Debian-based systems install mariadb-server
apt-get install -y default-mysql-server
# Supervisor
diff --git a/integration-tests/docker/druid.sh
b/integration-tests/docker/druid.sh
index 973d7055ca3..11c1ea2d6ce 100755
--- a/integration-tests/docker/druid.sh
+++ b/integration-tests/docker/druid.sh
@@ -78,21 +78,28 @@ setupConfig()
var=$(echo "$evar" | sed -e 's?^\([^=]*\)=.*?\1?g' -e 's?_?.?g')
setKey $DRUID_SERVICE "$var" "$val"
done
- if [ "$MYSQL_DRIVER_CLASSNAME" != "com.mysql.jdbc.Driver" ] ; then
- setKey $DRUID_SERVICE druid.metadata.mysql.driver.driverClassName
$MYSQL_DRIVER_CLASSNAME
- fi
+
+ setKey $DRUID_SERVICE druid.metadata.mysql.driver.driverClassName
$MYSQL_DRIVER_CLASSNAME
}
setupData()
{
# note: this function exists for legacy reasons, ideally we should do data
insert in IT's setup method.
- if [ -n "$DRUID_SERVICE" ]; then
- echo "DRUID_SERVICE is set, skipping data setup"
+ if [ ! -f /usr/lib/druid/conf/metadata-storage.conf ]; then
+ # Only metadata storage server need to set up data.
+ echo "Skip setup data. Metadata store is not configured."
return
fi
- # note: this function exists for legacy reasons, ideally we should do data
insert in IT's setup method.
- bash /run-mysql.sh
+ service mariadb start
+ for i in {30..0}; do
+ mysqladmin ping --silent && break
+ sleep 1
+ done
+ if [ "$i" = 0 ]; then
+ echo "MySQL did not start"
+ exit 1
+ fi
# The "query" and "security" test groups require data to be setup before
running the tests.
# In particular, they requires segments to be download from a pre-existing
s3 bucket.
# This is done by using the loadSpec put into metadatastore and s3
credientials set below.
@@ -105,4 +112,5 @@ setupData()
echo "GRANT ALL ON sqlinputsource.* TO 'druid'@'%'; CREATE database
sqlinputsource DEFAULT CHARACTER SET utf8mb4;" | mysql -u root druid
cat /test-data/sql-input-source-sample-data.sql | mysql -u root druid
fi
+ service mariadb stop
}
diff --git a/integration-tests/docker/run-mysql.sh
b/integration-tests/docker/run-mysql.sh
deleted file mode 100755
index aa5d165a62e..00000000000
--- a/integration-tests/docker/run-mysql.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-(mysqld --bind-address=0.0.0.0 || true) & # there might already be a mysqld
running, so we ignore the error
-/usr/bin/pidproxy /var/run/mysqld/mysqld.pid /usr/bin/mysqld_safe
--bind-address=0.0.0.0
-echo "Waiting for MySQL to be ready...";
-for i in {30..0}; do
- mysqladmin ping --silent && break;
- sleep 1; \
-done; \
-if [ "$i" = 0 ]; then
- echo "MySQL did not start"; exit 1;
-fi;
diff --git
a/integration-tests/docker/service-supervisords/metadata-storage.conf
b/integration-tests/docker/service-supervisords/metadata-storage.conf
index 828377403dd..0ec772b3ab4 100644
--- a/integration-tests/docker/service-supervisords/metadata-storage.conf
+++ b/integration-tests/docker/service-supervisords/metadata-storage.conf
@@ -1,5 +1,5 @@
[program:mysql]
-command=/run-mysql.sh
+command=/usr/bin/pidproxy /var/run/mysqld/mysqld.pid /usr/bin/mysqld_safe
--bind-address=0.0.0.0
user=mysql
priority=0
stdout_logfile=/shared/logs/mysql.log
diff --git a/integration-tests/script/docker_build_containers.sh
b/integration-tests/script/docker_build_containers.sh
index 9a5214ffaa6..1243c0223e9 100755
--- a/integration-tests/script/docker_build_containers.sh
+++ b/integration-tests/script/docker_build_containers.sh
@@ -19,6 +19,11 @@ set -e
# Build Druid Cluster Image
set -e
+if [ -z "$MYSQL_DRIVER_CLASSNAME" ]
+then
+ export MYSQL_DRIVER_CLASSNAME="com.mysql.jdbc.Driver"
+fi
+
if [ -z "$DRUID_INTEGRATION_TEST_JVM_RUNTIME" ]
then
echo "\$DRUID_INTEGRATION_TEST_JVM_RUNTIME is not set. Building
druid-cluster with default Java version"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]