Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: mysqlutil 8.0.33 (#7285)

Danny Xu77c52ff29e25
diff --git a/backend/resources/README.md b/backend/resources/README.md
index 3f9c4da712..89486f363c 100644
--- a/backend/resources/README.md
+++ b/backend/resources/README.md
@@ -17,28 +17,18 @@ darwin/amd64 used for MacOS amd64: https://repo1.maven.org/maven2/io/zonky/test/
darwin/arm64v8 used for MacOS arm64v8: https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-darwin-arm64v8/14.2.0/embedded-postgres-binaries-darwin-arm64v8-14.2.0.jar
-## MySQL
+## MySQL/mysqlutil
-We will embed MySQL binaries for testing. You need to run `go generate -tags mysql ./...` to download MySQL distributions first.
+We will embed MySQL binaries for testing. You need to run `GOOS=darwin GOARCH=amd64 go generate -tags mysql ./...` to download MySQL distributions first. We embed mysqlutil for PITR. MySQL does not provide separate mysql, mysqldump and mysqlbinlog binaries, and we need to extract our files from the MySQL distribution manually with `GOOS=darwin GOARCH=amd64 go generate --tags mysqlutil ./...`.
linux-glibc2.17-x86_64 used for Linux amd64: https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.33-linux-glibc2.17-x86_64-minimal.tar.xz
-linux-glibc2.17-aarch64.tar.gz used for Linux amd64: https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.33-linux-glibc2.17-aarch64-minimal.tar.gz
+linux-glibc2.17-aarch64.tar.gz used for Linux amd64: https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.33-linux-glibc2.17-aarch64.tar.gz
macos13-arm64 used for MacOS Apple Silicon: https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.33-macos13-arm64.tar.gz
macos13-x86_64 used for MacOS Intel processor: https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.33-macos13-x86_64.tar.gz
-### mysqlutil
-
-We embed mysqlutil for PITR. MySQL does not provide separate mysql, mysqldump and mysqlbinlog binaries, and we need to extract our files from the MySQL distribution manually.
-
-linux-glibc2.17-x86_64 used for Linux (MD5 55a7759e25cc527416150c8181ce3f6d): https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.28-linux-glibc2.17-x86_64-minimal.tar.xz, extract bin/mysqlbinlog, bin/mysql, bin/mysqldump, lib/private/libcrypto.so.1.1 and lib/private/libssl.so.1.1.
-
-macos11-arm64 used for MacOS Apple Silicon development (MD5 f1943053b12428e4c0e4ed309a636fd0): https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.28-macos11-arm64.tar.gz, extract bin/mysqlbinlog, bin/mysql, bin/mysqldump, lib/libcrypto.1.1.dylib and lib/libssl.1.1.dylib.
-
-macos11-x86_64 used for MacOS Intel Silicon development (MD5 b2d5b57edb92811040fd61c84f1c9d6f): https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.28-macos11-x86_64.tar.gz, extract bin/mysqlbinlog, bin/mysql, bin/mysqldump, lib/libcrypto.1.1.dylib and lib/libssl.1.1.dylib.
-
### mongoutil
We embed mongoutil to execute the MongoDB commands input by users. It only contains the mongosh executable and the depending libs.
diff --git a/backend/resources/mysqlutil/build_mysqlutil.sh b/backend/resources/mysqlutil/build_mysqlutil.sh
new file mode 100755
index 0000000000..2556771e71
--- /dev/null
+++ b/backend/resources/mysqlutil/build_mysqlutil.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+set -e
+
+OUT_PREFIX="mysqlutil-8.0.33"
+pack(){
+ echo $1
+ tar xvf $1
+ FILENAME=$(basename $1)
+ FILENAME_NOEXT="${FILENAME%.*.*}"
+ cd ${FILENAME_NOEXT}
+ case $2 in
+ linux)
+ tar cvzf ../${OUT_PREFIX}-$2-$3.tar.gz bin/mysqlbinlog bin/mysqldump bin/mysql lib/private/libcrypto* lib/private/libssl*
+ ;;
+ darwin)
+ tar cvzf ../${OUT_PREFIX}-$2-$3.tar.gz bin/mysqlbinlog bin/mysqldump bin/mysql lib/libcrypto* lib/libssl*
+ ;;
+ esac
+ rm -rf $(pwd)
+ cd ..
+}
+
+GOOS=darwin GOARCH=amd64 go generate --tags mysql ../mysql/...
+GOOS=darwin GOARCH=arm64 go generate --tags mysql ../mysql/...
+GOOS=linux GOARCH=amd64 go generate --tags mysql ../mysql/...
+GOOS=linux GOARCH=arm64 go generate --tags mysql ../mysql/...
+
+pack ../mysql/mysql-8.0.33-macos13-x86_64.tar.gz darwin amd64
+pack ../mysql/mysql-8.0.33-macos13-arm64.tar.gz darwin arm64
+pack ../mysql/mysql-8.0.33-linux-glibc2.17-x86_64-minimal.tar.xz linux amd64
+pack ../mysql/mysql-8.0.33-linux-glibc2.17-aarch64.tar.gz linux arm64
diff --git a/backend/resources/mysqlutil/mysqlutil.go b/backend/resources/mysqlutil/mysqlutil.go
index 4cea1b35f9..a39da8dc31 100644
--- a/backend/resources/mysqlutil/mysqlutil.go
+++ b/backend/resources/mysqlutil/mysqlutil.go
@@ -2,10 +2,8 @@
package mysqlutil
import (
- "bytes"
"fmt"
"os"
- "os/exec"
"path"
"path/filepath"
"runtime"
@@ -41,42 +39,21 @@ func GetPath(binName binaryName, binDir string) string {
return "UNKNOWN_BINARY"
}
-// getExecutableVersion returns the raw output of "binName -V".
-func getExecutableVersion(binName binaryName, binDir string) (string, error) {
- var cmd *exec.Cmd
- var v bytes.Buffer
- switch binName {
- case MySQL:
- cmd = exec.Command(GetPath(MySQL, binDir), "-V")
- case MySQLBinlog:
- cmd = exec.Command(GetPath(MySQLBinlog, binDir), "-V")
- case MySQLDump:
- cmd = exec.Command(GetPath(MySQLDump, binDir), "-V")
- default:
- return "", errors.Errorf("unknown binary name: %s", binName)
- }
-
- cmd.Stdout = &v
- cmd.Stderr = os.Stderr
- if err := cmd.Run(); err != nil {
- return "", err
- }
- return v.String(), nil
-}
-
func getTarNameAndVersion() (tarname string, version string, err error) {
var tarName string
switch {
- case runtime.GOOS == "darwin" && runtime.GOARCH == "arm64":
- tarName = "mysqlutil-8.0.28-macos11-arm64.tar.gz"
case runtime.GOOS == "darwin" && runtime.GOARCH == "amd64":
- tarName = "mysqlutil-8.0.28-macos11-x86_64.tar.gz"
+ tarName = "mysqlutil-8.0.33-darwin-amd64.tar.gz"
+ case runtime.GOOS == "darwin" && runtime.GOARCH == "arm64":
+ tarName = "mysqlutil-8.0.33-darwin-arm64.tar.gz"
case runtime.GOOS == "linux" && runtime.GOARCH == "amd64":
- tarName = "mysqlutil-8.0.28-linux-glibc2.17-x86_64.tar.gz"
+ tarName = "mysqlutil-8.0.33-linux-amd64.tar.gz"
+ case runtime.GOOS == "linux" && runtime.GOARCH == "arm64":
+ tarName = "mysqlutil-8.0.33-linux-arm64.tar.gz"
default:
return "", "", errors.Errorf("unsupported combination of OS %q and ARCH %q", runtime.GOOS, runtime.GOARCH)
}
- return tarName, strings.TrimSuffix(tarName, "tar.gz"), nil
+ return tarName, strings.TrimSuffix(tarName, ".tar.gz"), nil
}
// Install will extract the mysqlutil tar in resourceDir.
diff --git a/backend/resources/mysqlutil/mysqlutil_test.go b/backend/resources/mysqlutil/mysqlutil_test.go
deleted file mode 100644
index 77979df69b..0000000000
--- a/backend/resources/mysqlutil/mysqlutil_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package mysqlutil
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-// TestRunBinary tests whether all binarys can be started on the target platform
-// to check whether the lib extraction is correct.
-func TestRunBinary(t *testing.T) {
- t.Parallel()
-
- a := require.New(t)
- tmpDir := t.TempDir()
- binDir, err := Install(tmpDir)
- a.NoError(err)
-
- t.Run("run mysql client", func(t *testing.T) {
- _, err := getExecutableVersion(MySQL, binDir)
- a.NoError(err)
- })
-
- t.Run("run mysqlbinlog", func(t *testing.T) {
- _, err := getExecutableVersion(MySQLBinlog, binDir)
- a.NoError(err)
- })
-
- t.Run("run mysqldump", func(t *testing.T) {
- _, err := getExecutableVersion(MySQLDump, binDir)
- a.NoError(err)
- })
-}
diff --git a/backend/resources/mysqlutil/resources_darwin_amd64.go b/backend/resources/mysqlutil/resources_darwin_amd64.go
index f3a714da8a..ca12ad3584 100644
--- a/backend/resources/mysqlutil/resources_darwin_amd64.go
+++ b/backend/resources/mysqlutil/resources_darwin_amd64.go
@@ -2,5 +2,5 @@ package mysqlutil
import "embed"
-//go:embed mysqlutil-8.0.28-macos11-x86_64.tar.gz
+//go:embed mysqlutil-8.0.33-darwin-amd64.tar.gz
var resources embed.FS
diff --git a/backend/resources/mysqlutil/resources_darwin_arm64.go b/backend/resources/mysqlutil/resources_darwin_arm64.go
index 77a2428542..fb71263d69 100644
--- a/backend/resources/mysqlutil/resources_darwin_arm64.go
+++ b/backend/resources/mysqlutil/resources_darwin_arm64.go
@@ -2,5 +2,5 @@ package mysqlutil
import "embed"
-//go:embed mysqlutil-8.0.28-macos11-arm64.tar.gz
+//go:embed mysqlutil-8.0.33-darwin-arm64.tar.gz
var resources embed.FS
diff --git a/backend/resources/mysqlutil/resources_linux_amd64.go b/backend/resources/mysqlutil/resources_linux_amd64.go
index bc4eeeff10..baf5f237cf 100644
--- a/backend/resources/mysqlutil/resources_linux_amd64.go
+++ b/backend/resources/mysqlutil/resources_linux_amd64.go
@@ -2,5 +2,5 @@ package mysqlutil
import "embed"
-//go:embed mysqlutil-8.0.28-linux-glibc2.17-x86_64.tar.gz
+//go:embed mysqlutil-8.0.33-linux-amd64.tar.gz
var resources embed.FS
diff --git a/backend/resources/mysqlutil/resources_linux_arm64.go b/backend/resources/mysqlutil/resources_linux_arm64.go
index 1595232079..c8c39f550d 100644
--- a/backend/resources/mysqlutil/resources_linux_arm64.go
+++ b/backend/resources/mysqlutil/resources_linux_arm64.go
@@ -2,7 +2,5 @@ package mysqlutil
import "embed"
-// TODO(zp): We cheat go build here, we don't provide mysqlutil on linux arm64 now.
-//
-//go:embed mysqlutil-8.0.28-linux-glibc2.17-x86_64.tar.gz
+//go:embed mysqlutil-8.0.33-linux-arm64.tar.gz
var resources embed.FS
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 7514ce819d..8704cad251 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -88,7 +88,7 @@ COPY ./scripts/.psqlrc /root/.psqlrc
# Our HEALTHCHECK instruction in dockerfile needs curl.
# Install psmisc to use killall command in demo.sh used by render.com.
-RUN apt-get update && apt-get install -y locales curl psmisc postgresql-client procps
+RUN apt-get update && apt-get install -y locales curl psmisc postgresql-client procps libncurses5
# Generate en_US.UTF-8 locale which is needed to start postgres server.
# Fix the posgres server issue (invalid value for parameter "lc_messages": "en_US.UTF-8").
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
diff --git a/scripts/Dockerfile.render-demo b/scripts/Dockerfile.render-demo
index 9f8b497608..65a3af4fc9 100644
--- a/scripts/Dockerfile.render-demo
+++ b/scripts/Dockerfile.render-demo
@@ -67,7 +67,7 @@ LABEL org.opencontainers.image.authors=${BUILD_USER}
# Our HEALTHCHECK instruction in dockerfile needs curl.
# Install psmisc to use killall command in demo.sh used by render.com.
-RUN apt-get update && apt-get install -y locales curl psmisc
+RUN apt-get update && apt-get install -y locales curl psmisc libncurses5
# Generate en_US.UTF-8 locale which is needed to start postgres server.
# Fix the posgres server issue (invalid value for parameter "lc_messages": "en_US.UTF-8").
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
diff --git a/scripts/Dockerfile.sql-service b/scripts/Dockerfile.sql-service
index a088bfdc34..22d981e7f7 100644
--- a/scripts/Dockerfile.sql-service
+++ b/scripts/Dockerfile.sql-service
@@ -47,7 +47,7 @@ LABEL org.opencontainers.image.created=${BUILD_TIME}
LABEL org.opencontainers.image.authors=${BUILD_USER}
# Our HEALTHCHECK instruction in dockerfile needs curl.
-RUN apt-get update && apt-get install -y curl
+RUN apt-get update && apt-get install -y curl libncurses5
COPY --from=sql /sql-service-build/sql-service /usr/local/bin/
COPY --from=sql /etc/ssl/certs /etc/ssl/certs