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

Adds MySQL 8.4 3rd Party Integration tests #1825

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,60 +1,2 @@
set -e

source /etc/os-release
VERSION_ID=${VERSION_ID%%.*}

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo yum -y install https://repo.mysql.com/mysql80-community-release-el${VERSION_ID}.rpm

if [ ${VERSION_ID} == 8 ]; then
sudo yum -y module disable mysql
fi
sudo yum -y install mysql-community-server

echo "default-authentication-plugin=mysql_native_password" | sudo tee -a /etc/my.cnf

sudo service mysqld start

password=$(sudo grep -oP '(?<=temporary password is generated for root@localhost: ).*$' /var/log/mysqld.log)

cat <<EOF > config-user
[client]
user=root
password='$password'
EOF

mysql --defaults-extra-file=config-user -Bse "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Ss123%321'; FLUSH PRIVILEGES;" --connect-expired-password

# default socket path is different from originally set default (from debian/ubuntu), so we need to create a symlink
sudo ln -s /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock

sudo mkdir /var/log/mysql
sudo chown mysql:mysql /var/log/mysql

# Required to allow mysql to accept connections on 3307
if [ ${ID} == rocky ]; then
sudo yum install -y policycoreutils-python-utils
else
sudo yum install -y policycoreutils-python
fi
sudo semanage port --add --type mysqld_port_t --proto tcp 3307

# set up replication source to validate replica metrics
# set main target (replica) to use binary logging for replication to work
sudo tee -a /etc/my.cnf >/dev/null <<EOF
server-id = 1
log-bin = /var/log/mysql/mysql-bin.log

[mysqld2]
pid-file = /var/run/mysqld/mysql2.pid
socket = /var/run/mysqld/mysql2.sock
port = 3307
user = mysql
datadir = /var/lib/mysql2/
log-error = /var/log/mysql/error2.log
server-id = 2
log-bin = /var/log/mysql/mysql2-bin.log
EOF

sudo service mysqld restart
# Centos/RHEL is not tested
exit 1
Original file line number Diff line number Diff line change
@@ -1,54 +1,2 @@
set -e

sudo apt update
sudo apt install -y wget

wget --no-verbose https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.29-1_all.deb
sudo apt update
sudo debconf-set-selections <<< 'mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)'

source /etc/os-release

sudo apt install -y mysql-server

if [[ "${ID}" == debian && "${VERSION_ID}" == 9 ]]; then
sudo apt install -y libmariadbclient18
elif [[ "${ID}" == ubuntu && "${VERSION_ID}" == 1[68].04 ]]; then
sudo apt install -y libmysqlclient20
elif [[ "${ID}" == ubuntu ]]; then # 19.10 and later
sudo apt install -y libmysqlclient21
fi

sudo service mysql start

# set up replication source to validate replica metrics
# set main target (replica) to use binary logging for replication to work
sudo tee -a /etc/mysql/mysql.conf.d/mysqld.cnf >/dev/null <<EOF
server-id = 1
log-bin = /var/log/mysql/mysql-bin.log

[mysqld2]
pid-file = /var/run/mysqld/mysql2.pid
socket = /var/run/mysqld/mysql2.sock
port = 3307
user = mysql
datadir = /var/lib/mysql2/
log-error = /var/log/mysql/error2.log
server-id = 2
log-bin = /var/log/mysql/mysql2-bin.log
EOF

# Disable apparmor for mysql
if [[ "${ID}" == ubuntu ]]; then
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
fi

sudo cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/conf.d/

sudo chmod uga+r /etc/mysql/conf.d/*
sudo chown mysql:mysql /etc/mysql/conf.d/*
sudo chown mysql:mysql /var/log/mysql/

sudo service mysql restart
# Debian/Ubuntu is not tested
exit 1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ sudo mysql --defaults-extra-file=config-user -S /var/run/mysqld/mysql2.sock -Bse
sudo mysqldump --defaults-extra-file=config-user -S /var/run/mysqld/mysql2.sock --all-databases --source-data > /tmp/dbdump.sql

# Capture status to seed replica
raw_status=$(sudo mysql --defaults-extra-file=config-user -S /var/run/mysqld/mysql2.sock -Bse "SHOW MASTER STATUS;")
raw_status=$(sudo mysql --defaults-extra-file=config-user -S /var/run/mysqld/mysql2.sock -Bse "SHOW BINARY LOG STATUS;")
read -r logfile logpos <<< $raw_status

# Dump data from source into replica
Expand All @@ -46,4 +46,4 @@ sudo mysql --defaults-extra-file=config-user -Bse "SET GLOBAL long_query_time =
sudo mysql --defaults-extra-file=config-user -Bse "SET GLOBAL slow_query_log = 1"
sudo mysql --defaults-extra-file=config-user -Bse "SET GLOBAL general_log = 'ON'"

sudo mysql --defaults-extra-file=config-user -Bse "select table_catalog, table_schema, table_name from information_schema.tables"
sudo mysql --defaults-extra-file=config-user -Bse "select table_catalog, table_schema, table_name from information_schema.tables"
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,28 @@ minimum_supported_agent_version:
logging: 2.5.0
supported_operating_systems: linux
platforms_to_skip:
# MySQL is not currently supported on various distros.
# MySQL is not currently supported on various distros. - ml-images:common-gpu-debian-11-py310
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment

- debian-cloud:debian-11
- debian-cloud:debian-12
- debian-cloud:debian-12-arm64
- ml-images:common-gpu-debian-11-py310
- rocky-linux-cloud:rocky-linux-8
- rocky-linux-cloud:rocky-linux-8-optimized-gcp-arm64
- rocky-linux-cloud:rocky-linux-9
- rocky-linux-cloud:rocky-linux-9-arm64
- ubuntu-os-cloud:ubuntu-2004-lts
- ubuntu-os-cloud:ubuntu-2004-lts-arm64
- ubuntu-os-cloud:ubuntu-2204-lts
- ubuntu-os-cloud:ubuntu-2204-lts-arm64
- ubuntu-os-cloud:ubuntu-2404-lts-amd64
- ubuntu-os-cloud:ubuntu-2404-lts-arm64
- ubuntu-os-cloud:ubuntu-2410-amd64
- ubuntu-os-cloud:ubuntu-minimal-2410-amd64
- ubuntu-os-cloud:ubuntu-2410-arm64
- ubuntu-os-cloud:ubuntu-minimal-2410-arm64
- suse-cloud:sles-12
- suse-cloud:sles-15-arm64
supported_app_version: ["5.7", "8.0"]
supported_app_version: ["5.7", "8.0", "8.4"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit will update our public docs; I would hold off making this change until we've finished adding the other (Debian, Ubuntu, RH, etc.) distros to the tests. (Those other distros can be added in follow-up PRs later since this one was just focused on SLES 15.)

expected_metrics:
- type: workload.googleapis.com/mysql.buffer_pool_data_pages
value_type: INT64
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended to work on openSUSE as well? If so then I'll try to put it through a manual test run since the presubmits don't run openSUSE; if not then openSUSE should be added to the skipped platforms.

Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,40 @@ set -e
source /etc/os-release
SUSE_VERSION="${VERSION_ID%%.*}"

if [[ "${ID}" == opensuse-leap && "${VERSION_ID}" == 15.[01] ]]; then
if [[ "${VERSION_ID}" == 15.0 ]]; then
sudo zypper modifyrepo --disable openSUSE-Leap-Cloud-Tools
elif [[ "${VERSION_ID}" == 15.1 ]]; then
sudo zypper modifyrepo --disable openSUSE-Leap-devel-languages-python-aws
fi
sudo zypper -n refresh

sudo zypper -n install mariadb
else
mysql_repo_pkg_name=''
if [[ "${SUSE_VERSION}" == 12 ]]; then
mysql_repo_pkg_name=mysql80-community-release-sles12.rpm
elif [[ "${SUSE_VERSION}" == 15 ]]; then
mysql_repo_pkg_name=mysql80-community-release-sl15.rpm
fi

if [[ "${ID}" == sles ]]; then
# Installation followed in: https://dev.mysql.com/doc/mysql-sles-repo-quick-guide/en/
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo zypper -n install https://dev.mysql.com/get/${mysql_repo_pkg_name}
sudo zypper -n install https://dev.mysql.com/get/mysql84-community-release-sl15.rpm
sudo zypper -n install mysql-community-server
fi

if [[ "${SUSE_VERSION}" == 12 ]]; then
sudo zypper -n install libmysqlclient18
elif [[ "${SUSE_VERSION}" == 15 ]]; then
if [[ "${SUSE_VERSION}" == 15 ]]; then
sudo zypper -n install libmariadb3
fi

## Default configuration
cat <<EOF | sudo tee /etc/my.cnf > /dev/null
[mysqld]
mysql_native_password=ON
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysql/mysqld.log
pid-file=/var/run/mysql/mysqld.pid
EOF

sudo service mysql start

if [[ "${ID}" == opensuse-leap && "${VERSION_ID}" == 15.[01] ]]; then
# mariadb default root password is empty.
mysql -u root --skip-password -Bse "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Ss123%321'; FLUSH PRIVILEGES;"
else
password="$(sudo grep -oP '(?<=temporary password is generated for root@localhost: ).*$' /var/log/mysql/mysqld.log)"
password="$(sudo grep -oP '(?<=temporary password is generated for root@localhost: ).*$' /var/log/mysql/mysqld.log)"

cat <<EOF >config-user
[client]
user=root
password='$password'
cat <<EOF >config-user
[client]
user=root
password='$password'
EOF

mysql --defaults-extra-file=config-user -Bse "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Ss123%321'; FLUSH PRIVILEGES;" --connect-expired-password
fi
mysql --defaults-extra-file=config-user -Bse "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Ss123%321'; FLUSH PRIVILEGES;" --connect-expired-password

# default socket path is different from originally set default (from debian/ubuntu), so we need to create a symlink
sudo mkdir /var/run/mysqld/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ platforms_to_skip:
- ubuntu-os-cloud:ubuntu-minimal-2410-amd64
- ubuntu-os-cloud:ubuntu-2410-arm64
- ubuntu-os-cloud:ubuntu-minimal-2410-arm64
supported_app_version: ["5.7", "8.0"]
supported_app_version: ["5.7", "8.0", "8.4"]
expected_metrics:
- type: workload.googleapis.com/mysql.buffer_pool_data_pages
value_type: INT64
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
set -e

source /etc/os-release
VERSION_ID=${VERSION_ID%%.*}

sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo yum -y install https://repo.mysql.com/mysql80-community-release-el${VERSION_ID}.rpm

if [ ${VERSION_ID} == 8 ]; then
sudo yum -y module disable mysql
fi
sudo yum -y install mysql-community-server

echo "default-authentication-plugin=mysql_native_password" | sudo tee -a /etc/my.cnf

sudo service mysqld start

password=$(sudo grep -oP '(?<=temporary password is generated for root@localhost: ).*$' /var/log/mysqld.log)

cat <<EOF > config-user
[client]
user=root
password='$password'
EOF

mysql --defaults-extra-file=config-user -Bse "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Ss123%321'; FLUSH PRIVILEGES;" --connect-expired-password

# default socket path is different from originally set default (from debian/ubuntu), so we need to create a symlink
sudo ln -s /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock

sudo mkdir /var/log/mysql
sudo chown mysql:mysql /var/log/mysql

# Required to allow mysql to accept connections on 3307
if [ ${ID} == rocky ]; then
sudo yum install -y policycoreutils-python-utils
else
sudo yum install -y policycoreutils-python
fi
sudo semanage port --add --type mysqld_port_t --proto tcp 3307

# set up replication source to validate replica metrics
# set main target (replica) to use binary logging for replication to work
sudo tee -a /etc/my.cnf >/dev/null <<EOF
server-id = 1
log-bin = /var/log/mysql/mysql-bin.log

[mysqld2]
pid-file = /var/run/mysqld/mysql2.pid
socket = /var/run/mysqld/mysql2.sock
port = 3307
user = mysql
datadir = /var/lib/mysql2/
log-error = /var/log/mysql/error2.log
server-id = 2
log-bin = /var/log/mysql/mysql2-bin.log
EOF

sudo service mysqld restart
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
set -e

sudo apt update
sudo apt install -y wget

wget --no-verbose https://dev.mysql.com/get/mysql-apt-config_0.8.29-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.29-1_all.deb
sudo apt update
sudo debconf-set-selections <<< 'mysql-community-server mysql-server/default-auth-override select Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)'

source /etc/os-release

sudo apt install -y mysql-server

if [[ "${ID}" == debian && "${VERSION_ID}" == 9 ]]; then
sudo apt install -y libmariadbclient18
elif [[ "${ID}" == ubuntu && "${VERSION_ID}" == 1[68].04 ]]; then
sudo apt install -y libmysqlclient20
elif [[ "${ID}" == ubuntu ]]; then # 19.10 and later
sudo apt install -y libmysqlclient21
fi

sudo service mysql start

# set up replication source to validate replica metrics
# set main target (replica) to use binary logging for replication to work
sudo tee -a /etc/mysql/mysql.conf.d/mysqld.cnf >/dev/null <<EOF
server-id = 1
log-bin = /var/log/mysql/mysql-bin.log

[mysqld2]
pid-file = /var/run/mysqld/mysql2.pid
socket = /var/run/mysqld/mysql2.sock
port = 3307
user = mysql
datadir = /var/lib/mysql2/
log-error = /var/log/mysql/error2.log
server-id = 2
log-bin = /var/log/mysql/mysql2-bin.log
EOF

# Disable apparmor for mysql
if [[ "${ID}" == ubuntu ]]; then
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
fi

sudo cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/conf.d/

sudo chmod uga+r /etc/mysql/conf.d/*
sudo chown mysql:mysql /etc/mysql/conf.d/*
sudo chown mysql:mysql /var/log/mysql/

sudo service mysql restart
Loading
Loading