Skip to content

Commit

Permalink
issue-686: support MySQL 8.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shunki-fujita committed Jun 13, 2024
1 parent 486d308 commit 5bc885b
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 39 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
name: Integration tests with MySQL
strategy:
matrix:
mysql-version: ["8.0.35", "8.0.36", "8.0.37"]
mysql-version: ["8.0.28", "8.0.36", "8.0.37", "8.4.0"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -44,7 +44,7 @@ jobs:
name: Supported Kubernetes versions End-to-End Tests
strategy:
matrix:
mysql-version: ["8.0.37"]
mysql-version: ["8.4.0"]
k8s-version: ["1.27.13", "1.28.9", "1.29.4"]
runs-on:
group: moco
Expand All @@ -67,7 +67,7 @@ jobs:
name: Supported MySQL versions End-to-End Tests
strategy:
matrix:
mysql-version: ["8.0.35", "8.0.36", "8.0.37"]
mysql-version: ["8.0.28", "8.0.36", "8.0.37"]
k8s-version: ["1.29.4"]
runs-on:
group: moco
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: Integration tests with MySQL
strategy:
matrix:
mysql-version: ["8.0.18", "8.0.25", "8.0.26", "8.0.27", "8.0.28", "8.0.30", "8.0.31", "8.0.32", "8.0.33", "8.0.34", "8.0.35", "8.0.36", "8.0.37"]
mysql-version: ["8.0.28", "8.0.36", "8.0.37", "8.4.0"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -29,7 +29,7 @@ jobs:
name: Supported Kubernetes versions End-to-End Tests
strategy:
matrix:
mysql-version: ["8.0.37"]
mysql-version: ["8.4.0"]
k8s-version: ["1.27.13", "1.28.9", "1.29.4"]
runs-on:
group: moco
Expand All @@ -44,7 +44,7 @@ jobs:
name: Supported MySQL versions End-to-End Tests
strategy:
matrix:
mysql-version: ["8.0.18", "8.0.25", "8.0.26", "8.0.27", "8.0.28", "8.0.30", "8.0.31", "8.0.32", "8.0.33", "8.0.34", "8.0.35", "8.0.36", "8.0.37"]
mysql-version: ["8.0.28", "8.0.36", "8.0.37", "8.4.0"]
k8s-version: ["1.29.4"]
runs-on:
group: moco
Expand Down
14 changes: 7 additions & 7 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ Edit the following lines in `Dockerfile`:

```
# The tag should be the latest one
FROM ghcr.io/cybozu-go/moco/mysql:8.0.35.1 as mysql
FROM ghcr.io/cybozu-go/moco/mysql:8.4.0.1 as mysql
# See the below description for how to get the version string.
ARG MYSQLSH_VERSION=8.0.35-1
ARG MYSQLSH_VERSION=8.4.0-1
```

The MySQL shell debian package can be found in https://dev.mysql.com/downloads/shell/ .
Expand All @@ -88,23 +88,23 @@ MySQL versions appear twice:
name: Integration tests with MySQL
strategy:
matrix:
mysql-version: ["8.0.18", "8.0.25", "8.0.26", "8.0.27", "8.0.28", "8.0.30", "8.0.31", "8.0.32", "8.0.33", "8.0.34", "8.0.35"]
mysql-version: ["8.0.28", "8.0.36", "8.0.37", "8.4.0"]
...
# Matrix tests for the latest MySQL version on different Kubernetes versions.
e2e:
name: Supported Kubernetes versions End-to-End Tests
strategy:
matrix:
mysql-version: ["8.0.35"]
k8s-version: ["1.19.11", "1.20.7", "1.21.1"]
mysql-version: ["8.4.0"]
k8s-version: ["1.27.13", "1.28.9", "1.29.4"]
...
# Matrix tests for different MySQL versions on the latest supported Kubernetes version.
e2e-mysql:
name: Supported MySQL versions End-to-End Tests
strategy:
matrix:
mysql-version: ["8.0.18", "8.0.25", "8.0.26", "8.0.27", "8.0.28", "8.0.30", "8.0.31", "8.0.32", "8.0.33", "8.0.34", "8.0.35"]
k8s-version: ["1.21.1"]
mysql-version: ["8.0.28", "8.0.36", "8.0.37", "8.4.0"]
k8s-version: ["1.29.4"]
```
## Updating moco-agent
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ USER 10000:10000
ENTRYPOINT ["/moco-controller"]

# For MySQL binaries
FROM --platform=$TARGETPLATFORM ghcr.io/cybozu-go/moco/mysql:8.0.37.1 as mysql
FROM --platform=$TARGETPLATFORM ghcr.io/cybozu-go/moco/mysql:8.4.0.1 as mysql

# the backup image
FROM --platform=$TARGETPLATFORM ghcr.io/cybozu/ubuntu:22.04
LABEL org.opencontainers.image.source https://github.com/cybozu-go/moco

ARG MYSQLSH_VERSION=8.0.37
ARG MYSQLSH_VERSION=8.4.0
ARG MYSQLSH_GLIBC_VERSION=2.28
ARG TARGETARCH

Expand All @@ -41,7 +41,7 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& if [ "${TARGETARCH}" = 'amd64' ]; then MYSQLSH_ARCH='x86-64'; fi \
&& if [ "${TARGETARCH}" = 'arm64' ]; then MYSQLSH_ARCH='arm-64'; fi \
&& curl -o /tmp/mysqlsh.tar.gz -fsL "https://cdn.mysql.com//Downloads/MySQL-Shell/mysql-shell-${MYSQLSH_VERSION}-linux-glibc${MYSQLSH_GLIBC_VERSION}-${MYSQLSH_ARCH:-unknown}bit.tar.gz" \
&& curl -o /tmp/mysqlsh.tar.gz -fsL "https://cdn.mysql.com/Downloads/MySQL-Shell/mysql-shell-${MYSQLSH_VERSION}-linux-glibc${MYSQLSH_GLIBC_VERSION}-${MYSQLSH_ARCH:-unknown}bit.tar.gz" \
&& mkdir /usr/local/mysql-shell \
&& tar -xf /tmp/mysqlsh.tar.gz -C /usr/local/mysql-shell --strip-components=1 \
&& rm -f /tmp/mysqlsh.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CTRL_RUNTIME_VERSION := $(shell awk '/sigs.k8s.io\/controller-runtime/ {print su
KUSTOMIZE_VERSION = 5.4.1
HELM_VERSION = 3.15.0
CRD_TO_MARKDOWN_VERSION = 0.0.3
MYSQLSH_VERSION = 8.0.37-1
MYSQLSH_VERSION = 8.4.0-1
MDBOOK_VERSION = 0.4.37
GORELEASER_VERSION = 1.26.1
YQ_VERSION = 4.44.1
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Blog article: [Introducing MOCO, a modern MySQL operator on Kubernetes](https://

## Supported software

- MySQL: 8.0.18, 8.0.25, 8.0.26, 8.0.27, 8.0.28, 8.0.30, 8.0.31, 8.0.32, 8.0.33, 8.0.34, 8.0.35, 8.0.36, 8.0.37
- MySQL: 8.0.28, 8.0.36, 8.0.37, 8.4.0
- Kubernetes: 1.27, 1.28, 1.29

MOCO supports (tests) the LTS releases of MySQL 8.
Expand Down Expand Up @@ -74,7 +74,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.37
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
volumeClaimTemplates:
- metadata:
name: mysql-data
Expand Down
12 changes: 6 additions & 6 deletions docs/custom-mysqld.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
```
If you want to build and use your own `mysqld`, read the rest of this document.
Expand All @@ -29,19 +29,19 @@ You should keep the following points:

## How to build `mysqld`

On Ubuntu 20.04, you can build the source code as follows:
On Ubuntu 22.04, you can build the source code as follows:

```console
$ sudo apt-get update
$ sudo apt-get -y --no-install-recommends install build-essential libssl-dev \
cmake libncurses5-dev libjemalloc-dev libnuma-dev libaio-dev pkg-config
$ curl -fsSL -O https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.20.tar.gz
$ tar -x -z -f mysql-boost-8.0.20.tar.gz
$ cd mysql-8.0.20
$ curl -fsSL -O https://dev.mysql.com/get/Downloads/MySQL-8.4/mysql-8.4.0.tar.gz
$ tar -x -z -f mysql-8.4.0.tar.gz
$ cd mysql-8.4.0
$ mkdir bld
$ cd bld
$ cmake .. -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Release \
-DWITH_BOOST=$(ls -d ../boost/boost_*) -DWITH_NUMA=1 -DWITH_JEMALLOC=1
-DWITH_NUMA=1 -DWITH_JEMALLOC=1
$ make -j $(nproc)
$ make install
```
6 changes: 3 additions & 3 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
containers:
# At least a container named "mysqld" must be defined.
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
# By limiting CPU and memory, Pods will have Guaranteed QoS class.
# requests can be omitted; it will be set to the same value as limits.
resources:
Expand Down Expand Up @@ -208,7 +208,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35 # must be the same version as the donor
image: ghcr.io/cybozu-go/moco/mysql:8.4.0 # must be the same version as the donor
volumeClaimTemplates:
- metadata:
name: mysql-data
Expand Down Expand Up @@ -727,7 +727,7 @@ spec:
containers:
- name: mysqld
# Edit the next line
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
```

You are advised to make backups and/or create a replica cluster before starting the upgrade process.
Expand Down
2 changes: 1 addition & 1 deletion e2e/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
KIND_VERSION = 0.23.0
KUBERNETES_VERSION = 1.29.4
CERT_MANAGER_VERSION = 1.14.5
MYSQL_VERSION = 8.0.37
MYSQL_VERSION = 8.4.0

KIND := $(dir $(shell pwd))/bin/kind
KUBECTL := $(dir $(shell pwd))/bin/kubectl
Expand Down
4 changes: 2 additions & 2 deletions e2e/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
var upgradeYAML string

const (
mysqlVersionOld = "8.0.18"
mysqlVersionNew = "8.0.25"
mysqlVersionOld = "8.0.28"
mysqlVersionNew = "8.4.0"
)

var _ = Context("upgrade", func() {
Expand Down
2 changes: 1 addition & 1 deletion examples/anti-affinity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
topologyKey: "kubernetes.io/hostname"
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
resources:
requests:
cpu: "10"
Expand Down
2 changes: 1 addition & 1 deletion examples/collect-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
volumeClaimTemplates:
- metadata:
name: mysql-data
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-mycnf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
volumeClaimTemplates:
- metadata:
name: mysql-data
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-probe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
# If you want to override the default probes, you cannot override the httpGet.
livenessProbe:
failureThreshold: 3
Expand Down
2 changes: 1 addition & 1 deletion examples/guaranteed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
# By limiting CPU and memory, Pods will have Guaranteed QoS class.
# requests can be omitted; it will be set to the same value as limits.
resources:
Expand Down
2 changes: 1 addition & 1 deletion examples/loadbalancer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
spec:
containers:
- name: mysqld
image: ghcr.io/cybozu-go/moco/mysql:8.0.35
image: ghcr.io/cybozu-go/moco/mysql:8.4.0
volumeClaimTemplates:
- metadata:
name: mysql-data
Expand Down
9 changes: 8 additions & 1 deletion pkg/bkop/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
"time"

"github.com/cybozu-go/moco/pkg/constants"
Expand Down Expand Up @@ -76,7 +77,13 @@ var _ = Describe("Operator", func() {
opRe.(operator).db.MustExec(`DROP USER 'root'@'localhost'`)
opRe.(operator).db.MustExec(`DROP USER 'root'@'%'`)
opRe.(operator).db.MustExec(`FLUSH LOCAL PRIVILEGES`)
opRe.(operator).db.MustExec(`RESET MASTER`)

mysqlVersion := os.Getenv("MYSQL_VERSION")
if strings.HasPrefix(mysqlVersion, "8.4") {
opRe.(operator).db.MustExec(`RESET BINARY LOGS AND GTIDS`)
} else {
opRe.(operator).db.MustExec(`RESET MASTER`)
}
opRe.(operator).db.MustExec(`SET GLOBAL super_read_only=1`)

baseDir, err = os.MkdirTemp("", "")
Expand Down
2 changes: 1 addition & 1 deletion pkg/dbop/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var _ = Describe("replication", func() {
Expect(err).NotTo(HaveOccurred())
err = ops[1].WaitForGTID(ctx, st0.GlobalVariables.ExecutedGTID, 1)
Expect(err).To(MatchError(ErrTimeout))
_, err = ops[1].db.Exec(`START SLAVE`)
_, err = ops[1].db.Exec(`START REPLICA`)
Expect(err).NotTo(HaveOccurred())
err = ops[1].WaitForGTID(ctx, st0.GlobalVariables.ExecutedGTID, 0)
Expect(err).NotTo(HaveOccurred())
Expand Down
3 changes: 3 additions & 0 deletions pkg/mycnf/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ var DefaultMycnf = map[string]string{
// Disabled because of https://bugs.mysql.com/bug.php?id=104573
// The undo log truncate always fails on replica instances of `super_read_only = 1`.
"innodb_undo_log_truncate": "OFF",

// Disabled by default in MySQL 8.4
"loose_mysql_native_password": "ON",
}

// ConstMycnf is the mysqld configurations that MOCO applies forcibly.
Expand Down
1 change: 1 addition & 0 deletions pkg/mycnf/testdata/bufsize.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ long_query_time = 2
loose_binlog_transaction_compression = ON
loose_innodb_numa_interleave = ON
loose_innodb_validate_tablespace_paths = OFF
loose_mysql_native_password = ON
loose_replication_optimize_for_static_plugin_config = ON
loose_replication_sender_observe_commit_only = OFF
max_allowed_packet = 1G
Expand Down
1 change: 1 addition & 0 deletions pkg/mycnf/testdata/loose.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ log_slow_extra = ON
long_query_time = 2
loose_binlog_transaction_compression = ON
loose_innodb_validate_tablespace_paths = ON
loose_mysql_native_password = ON
loose_replication_optimize_for_static_plugin_config = ON
loose_replication_sender_observe_commit_only = OFF
loose_temptable_use_mmap = ON
Expand Down
1 change: 1 addition & 0 deletions pkg/mycnf/testdata/nil.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ long_query_time = 2
loose_binlog_transaction_compression = ON
loose_innodb_numa_interleave = ON
loose_innodb_validate_tablespace_paths = OFF
loose_mysql_native_password = ON
loose_replication_optimize_for_static_plugin_config = ON
loose_replication_sender_observe_commit_only = OFF
max_allowed_packet = 1G
Expand Down
1 change: 1 addition & 0 deletions pkg/mycnf/testdata/normalize.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ long_query_time = 2
loose_binlog_transaction_compression = ON
loose_innodb_numa_interleave = ON
loose_innodb_validate_tablespace_paths = OFF
loose_mysql_native_password = ON
loose_replication_optimize_for_static_plugin_config = ON
loose_replication_sender_observe_commit_only = OFF
max_allowed_packet = 1G
Expand Down
1 change: 1 addition & 0 deletions pkg/mycnf/testdata/opaque.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ long_query_time = 2
loose_binlog_transaction_compression = ON
loose_innodb_numa_interleave = ON
loose_innodb_validate_tablespace_paths = OFF
loose_mysql_native_password = ON
loose_replication_optimize_for_static_plugin_config = ON
loose_replication_sender_observe_commit_only = OFF
max_allowed_packet = 1G
Expand Down

0 comments on commit 5bc885b

Please sign in to comment.