diff --git a/pom.xml b/pom.xml index 3525d66..3b6473f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.facebook.airlift airbase - 95 + 104-SNAPSHOT com.facebook.presto @@ -34,15 +34,13 @@ true - true + true true - - 0.186 + 0.216-SNAPSHOT testing-mysql-server-base - testing-mysql-server-5 testing-mysql-server-8 @@ -55,9 +53,9 @@ - io.airlift + com.facebook.airlift command - 0.3 + 0.4-SNAPSHOT @@ -73,9 +71,9 @@ - io.airlift + com.facebook.airlift units - 1.0 + 1.4-SNAPSHOT diff --git a/testing-mysql-server-5/pom.xml b/testing-mysql-server-5/pom.xml deleted file mode 100644 index fce94b1..0000000 --- a/testing-mysql-server-5/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - 4.0.0 - - - com.facebook.presto - testing-mysql-server-root - 0.8-SNAPSHOT - - - testing-mysql-server-5 - testing-mysql-server-5 - - - ${project.parent.basedir} - - - - - com.facebook.presto - testing-mysql-server-base - - - - com.google.guava - guava - - - - mysql - mysql-connector-java - 5.1.48 - runtime - - - - - org.testng - testng - test - - - - com.facebook.presto - testing-mysql-server-base - test-jar - ${project.version} - test - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.6.0 - - - generate-resources - - exec - - - ${basedir}/repack-mysql-5.sh - - - - - - - - - ${project.build.directory}/generated-resources - - - - diff --git a/testing-mysql-server-5/repack-mysql-5.sh b/testing-mysql-server-5/repack-mysql-5.sh deleted file mode 100755 index 091e48d..0000000 --- a/testing-mysql-server-5/repack-mysql-5.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash - -set -eu - -VERSION=5.7.22 -BASEURL="https://dev.mysql.com/get/Downloads/MySQL-5.7" -PPC64LE_BASEURL="http://yum.mariadb.org/10.2/centos/7/ppc64le/rpms/" - -LINUX_BASE=mysql-$VERSION-linux-glibc2.12-x86_64 -LINUX_PPC64LE_RPM=MariaDB-server-10.2.36-1.el7.centos.ppc64le.rpm -OSX_BASE=mysql-$VERSION-macos10.13-x86_64 - -TAR=tar -command -v gtar >/dev/null && TAR=gtar - -if ! $TAR --version | grep -q "GNU tar" -then - echo "GNU tar is required." - echo "Hint: brew install gnu-tar" - $TAR --version - exit 100 -fi - -STRIP=strip -command -v gstrip >/dev/null && STRIP=gstrip - -if ! $STRIP --version | grep -q "GNU strip" -then - echo "GNU strip is required." - echo "Hint: brew install binutils" - exit 100 -fi - -set -x - -cd $(dirname $0) - -RESOURCES=target/generated-resources - -mkdir -p dist $RESOURCES - -LINUX_NAME=$LINUX_BASE.tar.gz -LINUX_DIST=dist/$LINUX_NAME - -LINUX_PPC64LE_DIST=dist/$LINUX_PPC64LE_RPM - -OSX_NAME=$OSX_BASE.tar.gz -OSX_DIST=dist/$OSX_NAME - -test -e $LINUX_DIST || curl -L -o $LINUX_DIST "$BASEURL/$LINUX_NAME" --fail -test -e $LINUX_PPC64LE_DIST || curl -L -o $LINUX_PPC64LE_DIST "$PPC64LE_BASEURL/$LINUX_PPC64LE_RPM" --fail -test -e $OSX_DIST || curl -L -o $OSX_DIST "$BASEURL/$OSX_NAME" --fail - -PACKDIR=$(mktemp -d "${TMPDIR:-/tmp}/mysql.XXXXXXXXXX") -$TAR -xf $LINUX_DIST -C $PACKDIR -pushd $PACKDIR/$LINUX_BASE -$STRIP bin/mysqld -$TAR -czf $OLDPWD/$RESOURCES/mysql-Linux-amd64.tar.gz \ - COPYING \ - README \ - docs/INFO* \ - share/*.sql \ - share/*.txt \ - share/charsets \ - share/english \ - bin/mysqld -popd -rm -rf $PACKDIR - -PACKDIR=$(mktemp -d "${TMPDIR:-/tmp}/mysql.XXXXXXXXXX") -cp $LINUX_PPC64LE_DIST $PACKDIR/ -pushd $PACKDIR -rpm2cpio $LINUX_PPC64LE_RPM | cpio -idm -mkdir -p mysql-Linux-ppc64le/bin mysql-Linux-ppc64le/lib64 mysql-Linux-ppc64le/share mysql-Linux-ppc64le/data -cp usr/bin/mysql_install_db mysql-Linux-ppc64le/bin/ -cp usr/bin/my_print_defaults mysql-Linux-ppc64le/bin/ -cp usr/bin/resolveip mysql-Linux-ppc64le/bin/ -cp usr/sbin/mysqld mysql-Linux-ppc64le/bin/ -cp -r usr/lib64/* mysql-Linux-ppc64le/lib64/ -cp -r usr/share/mysql mysql-Linux-ppc64le/share/ -$TAR -C ./mysql-Linux-ppc64le -czf $OLDPWD/$RESOURCES/mysql-Linux-ppc64le.tar.gz bin lib64 share data -popd -rm -rf $PACKDIR - -PACKDIR=$(mktemp -d "${TMPDIR:-/tmp}/mysql.XXXXXXXXXX") -$TAR -xf $OSX_DIST -C $PACKDIR -pushd $PACKDIR/$OSX_BASE -$TAR -czf $OLDPWD/$RESOURCES/mysql-Mac_OS_X-x86_64.tar.gz \ - COPYING \ - README \ - docs/INFO* \ - share/*.sql \ - share/*.txt \ - share/charsets \ - share/english \ - bin/mysqld -popd -rm -rf $PACKDIR diff --git a/testing-mysql-server-5/src/main/java/com/facebook/presto/testing/mysql/EmbeddedMySql5.java b/testing-mysql-server-5/src/main/java/com/facebook/presto/testing/mysql/EmbeddedMySql5.java deleted file mode 100644 index 1003179..0000000 --- a/testing-mysql-server-5/src/main/java/com/facebook/presto/testing/mysql/EmbeddedMySql5.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed 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. - */ -package com.facebook.presto.testing.mysql; - -import com.google.common.collect.ImmutableList; - -import java.io.IOException; -import java.util.List; - -final class EmbeddedMySql5 - extends AbstractEmbeddedMySql -{ - public EmbeddedMySql5(MySqlOptions mySqlOptions) - throws IOException - { - super(mySqlOptions); - } - - @Override - public List getInitializationArguments() - { - ImmutableList.Builder iList = ImmutableList.builder() - .add( - "--no-defaults", - "--skip-sync-frm", - "--innodb-flush-method=nosync", - "--datadir=" + getDataDirectory()); - - if (isMariadb) { - return iList.add("--basedir=" + getBaseDirectory()).build(); - } - else { - return iList.add("--initialize-insecure").build(); - } - } - - @Override - public List getStartArguments() - { - ImmutableList.Builder iList = ImmutableList.builder() - .add( - "--no-defaults", - "--default-time-zone=+00:00", - "--skip-sync-frm", - "--innodb-flush-method=nosync", - "--innodb-flush-log-at-trx-commit=0", - "--innodb-doublewrite=0", - "--bind-address=localhost", - "--port=" + String.valueOf(getPort()), - "--datadir=" + getDataDirectory(), - "--socket=" + getSocketDirectory()); - - if (isMariadb) { - return iList - .add( - "--basedir=" + getBaseDirectory(), - "--plugin-dir=" + getMariadbPluginDirectory(), - "--log-error=" + getDataDirectory() + "mariadb.log", - "--pid-file=" + getDataDirectory() + "mariadb.pid") - .build(); - } - else { - return iList - .add( - "--skip-ssl", - "--disable-partition-engine-check", - "--explicit_defaults_for_timestamp", - "--lc_messages_dir=" + getShareDirectory()) - .build(); - } - } -} diff --git a/testing-mysql-server-5/src/main/java/com/facebook/presto/testing/mysql/TestingMySqlServer.java b/testing-mysql-server-5/src/main/java/com/facebook/presto/testing/mysql/TestingMySqlServer.java deleted file mode 100644 index 8ce10a2..0000000 --- a/testing-mysql-server-5/src/main/java/com/facebook/presto/testing/mysql/TestingMySqlServer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed 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. - */ -package com.facebook.presto.testing.mysql; - -import java.util.Arrays; - -import static java.lang.String.format; - -public final class TestingMySqlServer - extends AbstractTestingMySqlServer -{ - public TestingMySqlServer(String user, String password, String... databases) - throws Exception - { - this(user, password, Arrays.asList(databases)); - } - - public TestingMySqlServer(String user, String password, Iterable databases) - throws Exception - { - this(user, password, databases, MySqlOptions.builder().build()); - } - - public TestingMySqlServer(String user, String password, Iterable databases, MySqlOptions mySqlOptions) - throws Exception - { - super(new EmbeddedMySql5(mySqlOptions), user, password, databases); - } - - @Override - public String getJdbcUrl(String database) - { - return format("jdbc:mysql://localhost:%s/%s?user=%s&password=%s&useSSL=false", getPort(), database, getUser(), getPassword()); - } -} diff --git a/testing-mysql-server-5/src/test/java/com/facebook/presto/testing/mysql/TestTestingMySqlServer.java b/testing-mysql-server-5/src/test/java/com/facebook/presto/testing/mysql/TestTestingMySqlServer.java deleted file mode 100644 index 812c993..0000000 --- a/testing-mysql-server-5/src/test/java/com/facebook/presto/testing/mysql/TestTestingMySqlServer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed 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. - */ -package com.facebook.presto.testing.mysql; - -import static java.util.Arrays.asList; - -public class TestTestingMySqlServer - extends AbstractTestTestingMySqlServer -{ - // for ppc64le, mariadb 10.2.x is used as an alternative for mysql 5.7 - private static final boolean isMariadb = System.getProperty("os.arch").equals("ppc64le"); - - @Override - public String getMySqlVersion() - { - return (isMariadb ? "5.5.5-10.2.32-MariaDB" : "5.7.22"); - } - - @Override - public AbstractTestingMySqlServer createMySqlServer(String user, String password, String... databases) - throws Exception - { - return new TestingMySqlServer(user, password, asList(databases), MySqlOptions.builder().build()); - } -} diff --git a/testing-mysql-server-8/repack-mysql-8.sh b/testing-mysql-server-8/repack-mysql-8.sh index 6c36d20..8ae12b3 100755 --- a/testing-mysql-server-8/repack-mysql-8.sh +++ b/testing-mysql-server-8/repack-mysql-8.sh @@ -2,11 +2,12 @@ set -eu -VERSION=8.0.15 -BASEURL="https://dev.mysql.com/get/Downloads/MySQL-8.0" +VERSION=8.4.2 +BASEURL="https://downloads.mysql.com/archives/get/p/23/file" -LINUX_BASE=mysql-$VERSION-linux-glibc2.12-x86_64 -OSX_BASE=mysql-$VERSION-macos10.14-x86_64 +LINUX_BASE=mysql-$VERSION-linux-glibc2.28-x86_64 +MAC_OS_ARM64_BASE=mysql-$VERSION-macos14-arm64 +MAC_OS_AMD64_BASE=mysql-$VERSION-macos14-x86_64 TAR=tar command -v gtar >/dev/null && TAR=gtar @@ -22,13 +23,6 @@ fi STRIP=strip command -v gstrip >/dev/null && STRIP=gstrip -if ! $STRIP --version | grep -q "GNU strip" -then - echo "GNU strip is required." - echo "Hint: brew install binutils" - exit 100 -fi - set -x cd $(dirname $0) @@ -40,45 +34,66 @@ mkdir -p dist $RESOURCES LINUX_NAME=$LINUX_BASE.tar.xz LINUX_DIST=dist/$LINUX_NAME -OSX_NAME=$OSX_BASE.tar.gz -OSX_DIST=dist/$OSX_NAME +MAC_OS_ARM64_NAME=$MAC_OS_ARM64_BASE.tar.gz +MAC_OS_ARM64_DIST=dist/$MAC_OS_ARM64_NAME + +MAC_OS_AMD64_NAME=$MAC_OS_AMD64_BASE.tar.gz +MAC_OS_AMD64_DIST=dist/$MAC_OS_AMD64_NAME test -e $LINUX_DIST || curl -L -o $LINUX_DIST "$BASEURL/$LINUX_NAME" --fail -test -e $OSX_DIST || curl -L -o $OSX_DIST "$BASEURL/$OSX_NAME" --fail - -PACKDIR=$(mktemp -d "${TMPDIR:-/tmp}/mysql.XXXXXXXXXX") -$TAR -xf $LINUX_DIST -C $PACKDIR -pushd $PACKDIR/$LINUX_BASE -$STRIP bin/mysqld -$TAR -czf $OLDPWD/$RESOURCES/mysql-Linux-amd64.tar.gz \ - LICENSE \ - README \ - docs/INFO* \ - share/*.sql \ - share/*.txt \ - share/charsets \ - share/english \ - lib/libcrypto.* \ - lib/libssl.* \ - bin/libcrypto.* \ - bin/libssl.* \ - bin/mysqld -popd -rm -rf $PACKDIR - -PACKDIR=$(mktemp -d "${TMPDIR:-/tmp}/mysql.XXXXXXXXXX") -$TAR -xf $OSX_DIST -C $PACKDIR -pushd $PACKDIR/$OSX_BASE -$TAR -czf $OLDPWD/$RESOURCES/mysql-Mac_OS_X-x86_64.tar.gz \ - LICENSE \ - README \ - docs/INFO* \ - share/*.sql \ - share/*.txt \ - share/charsets \ - share/english \ - lib/libcrypto.* \ - lib/libssl.* \ - bin/mysqld -popd -rm -rf $PACKDIR +test -e $MAC_OS_ARM64_DIST || curl -L -o $MAC_OS_ARM64_DIST "$BASEURL/$MAC_OS_ARM64_NAME" --fail +test -e $MAC_OS_AMD64_DIST || curl -L -o $MAC_OS_AMD64_DIST "$BASEURL/$MAC_OS_AMD64_NAME" --fail + +# args: +# 1: DIST name +# 2: BASE name +# 3: packed name (e.g. mysql-$platform-$arch.tar.gz +function pack_macos() { + PACKDIR=$(mktemp -d "${TMPDIR:-/tmp}/mysql.XXXXXXXXXX") + $TAR -xf $1 -C $PACKDIR + pushd $PACKDIR/$2 + $TAR --dereference -czf $OLDPWD/$RESOURCES/$3 \ + LICENSE \ + README \ + docs/INFO* \ + share/*.sql \ + share/*.txt \ + share/charsets \ + share/english \ + */**/libcrypto.* \ + */**/libssl.* \ + */libcrypto.* \ + */libssl.* \ + */libprotobuf.* \ + */libprotobuf-lite.* \ + bin/mysqld + popd + rm -rf $PACKDIR +} + +# args: +# 1: DIST name +# 2: BASE name +# 3: packed name (e.g. mysql-$platform-$arch.tar.gz +function pack_linux() { + PACKDIR=$(mktemp -d "${TMPDIR:-/tmp}/mysql.XXXXXXXXXX") + $TAR -xf $1 -C $PACKDIR + pushd $PACKDIR/$2 + $TAR --dereference -czf $OLDPWD/$RESOURCES/$3 \ + LICENSE \ + README \ + docs/INFO* \ + share/*.sql \ + share/*.txt \ + share/charsets \ + share/english \ + */**/libcrypto.* \ + */**/libssl.* \ + bin/mysqld + popd + rm -rf $PACKDIR +} + +test -e $RESOURCES/mysql-Mac_OS_X-aarch64.tar.gz || pack_macos $MAC_OS_ARM64_DIST $MAC_OS_ARM64_BASE mysql-Mac_OS_X-aarch64.tar.gz +test -e $RESOURCES/mysql-Mac_OS_X-amd64.tar.gz || pack_macos $MAC_OS_AMD64_DIST $MAC_OS_AMD64_BASE mysql-Mac_OS_X-amd64.tar.gz +test -e $RESOURCES/mysql-Linux-amd64.tar.gz || pack_linux $LINUX_DIST $LINUX_BASE mysql-Linux-amd64.tar.gz diff --git a/testing-mysql-server-8/src/main/java/com/facebook/presto/testing/mysql/EmbeddedMySql8.java b/testing-mysql-server-8/src/main/java/com/facebook/presto/testing/mysql/EmbeddedMySql8.java index be840cb..10c614a 100644 --- a/testing-mysql-server-8/src/main/java/com/facebook/presto/testing/mysql/EmbeddedMySql8.java +++ b/testing-mysql-server-8/src/main/java/com/facebook/presto/testing/mysql/EmbeddedMySql8.java @@ -42,7 +42,6 @@ public List getStartArguments() { return ImmutableList.of( "--no-defaults", - "--skip-ssl", "--skip-mysqlx", "--default-time-zone=+00:00", "--innodb-flush-method=nosync", diff --git a/testing-mysql-server-8/src/test/java/com/facebook/presto/testing/mysql/TestTestingMySqlServer.java b/testing-mysql-server-8/src/test/java/com/facebook/presto/testing/mysql/TestTestingMySqlServer.java index 8210eb9..dfc2705 100644 --- a/testing-mysql-server-8/src/test/java/com/facebook/presto/testing/mysql/TestTestingMySqlServer.java +++ b/testing-mysql-server-8/src/test/java/com/facebook/presto/testing/mysql/TestTestingMySqlServer.java @@ -21,7 +21,7 @@ public class TestTestingMySqlServer @Override public String getMySqlVersion() { - return "8.0.15"; + return "8.4.2"; } @Override diff --git a/testing-mysql-server-base/pom.xml b/testing-mysql-server-base/pom.xml index 240c72c..0fb1709 100644 --- a/testing-mysql-server-base/pom.xml +++ b/testing-mysql-server-base/pom.xml @@ -21,7 +21,7 @@ - io.airlift + com.facebook.airlift command @@ -36,7 +36,7 @@ - io.airlift + com.facebook.airlift units diff --git a/testing-mysql-server-base/src/main/java/com/facebook/presto/testing/mysql/AbstractEmbeddedMySql.java b/testing-mysql-server-base/src/main/java/com/facebook/presto/testing/mysql/AbstractEmbeddedMySql.java index 4be9bc3..c00bad4 100644 --- a/testing-mysql-server-base/src/main/java/com/facebook/presto/testing/mysql/AbstractEmbeddedMySql.java +++ b/testing-mysql-server-base/src/main/java/com/facebook/presto/testing/mysql/AbstractEmbeddedMySql.java @@ -16,7 +16,6 @@ import com.facebook.airlift.log.Logger; import com.google.common.base.VerifyException; import com.google.common.collect.ImmutableList; -import com.google.common.io.ByteStreams; import io.airlift.command.Command; import io.airlift.command.CommandFailedException; import io.airlift.units.Duration; @@ -297,7 +296,7 @@ private void startOutputProcessor(InputStream in) { executor.execute(() -> { try { - ByteStreams.copy(in, System.out); + in.transferTo(System.out); } catch (IOException ignored) { }