diff --git a/bootstrap.sh b/bootstrap.sh index 3c58a603efc..6499fa0cf82 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -325,7 +325,7 @@ if [ "$BUILD_TESTS" == 1 ] ; then echo "MYSQL_FLAVOR environment variable not set. Using default: $MYSQL_FLAVOR" fi case "$MYSQL_FLAVOR" in - "MySQL56") + "MySQL56" | "MySQL80") myversion="$("$VT_MYSQL_ROOT/bin/mysql" --version)" [[ "$myversion" =~ Distrib\ 5\.[67] || "$myversion" =~ Ver\ 8\. ]] || fail "Couldn't find MySQL 5.6+ in $VT_MYSQL_ROOT. Set VT_MYSQL_ROOT to override search location." echo "Found MySQL 5.6+ installation in $VT_MYSQL_ROOT." diff --git a/config/mycnf/master_mysql80.cnf b/config/mycnf/master_mysql80.cnf new file mode 100644 index 00000000000..f81761ad906 --- /dev/null +++ b/config/mycnf/master_mysql80.cnf @@ -0,0 +1,38 @@ +# Options for enabling GTID +# https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-howto.html +gtid_mode = ON +log_bin +log_slave_updates +enforce_gtid_consistency + +# Crash-safe replication settings. +master_info_repository = TABLE +relay_log_info_repository = TABLE +relay_log_purge = 1 +relay_log_recovery = 1 + +# Native AIO tends to run into aio-max-nr limit during test startup. +innodb_use_native_aio = 0 + +# Semi-sync replication is required for automated unplanned failover +# (when the master goes away). Here we just load the plugin so it's +# available if desired, but it's disabled at startup. +# +# If the -enable_semi_sync flag is used, VTTablet will enable semi-sync +# at the proper time when replication is set up, or when masters are +# promoted or demoted. +plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so + +# When semi-sync is enabled, don't allow fallback to async +# if you get no ack, or have no slaves. This is necessary to +# prevent alternate futures when doing a failover in response to +# a master that becomes unresponsive. +rpl_semi_sync_master_timeout = 1000000000000000000 +rpl_semi_sync_master_wait_no_slave = 1 + +# disable mysqlx +mysqlx = 0 + +# 8.0 changes the default auth-plugin to caching_sha2_password +default_authentication_plugin = mysql_native_password +secure_file_priv = NULL diff --git a/docker/bootstrap/Dockerfile.mysql80 b/docker/bootstrap/Dockerfile.mysql80 index c82ee741dec..c281de0d0ae 100644 --- a/docker/bootstrap/Dockerfile.mysql80 +++ b/docker/bootstrap/Dockerfile.mysql80 @@ -11,6 +11,6 @@ RUN for i in $(seq 1 10); do apt-key adv --no-tty --recv-keys --keyserver ha.poo WORKDIR /vt/src/vitess.io/vitess -ENV MYSQL_FLAVOR MySQL56 +ENV MYSQL_FLAVOR MySQL80 USER vitess RUN ./bootstrap.sh \ No newline at end of file diff --git a/go/vt/mysqlctl/mysqld.go b/go/vt/mysqlctl/mysqld.go index c491e67fef2..bfa973203a5 100644 --- a/go/vt/mysqlctl/mysqld.go +++ b/go/vt/mysqlctl/mysqld.go @@ -653,6 +653,11 @@ func getMycnfTemplates(root string) []string { if !contains(cnfTemplatePaths, path) { cnfTemplatePaths = append(cnfTemplatePaths, path) } + case "MySQL80": + path := path.Join(root, "config/mycnf/master_mysql80.cnf") + if !contains(cnfTemplatePaths, path) { + cnfTemplatePaths = append(cnfTemplatePaths, path) + } default: path := path.Join(root, "config/mycnf/master_mysql56.cnf") // By default we assume Mysql56 compatable diff --git a/go/vt/vttest/environment.go b/go/vt/vttest/environment.go index 330ca80a759..970465b9cbd 100644 --- a/go/vt/vttest/environment.go +++ b/go/vt/vttest/environment.go @@ -125,6 +125,9 @@ func GetMySQLOptions(flavor string) (string, []string, error) { mycnf = append(mycnf, "config/mycnf/default-fast.cnf") mycnf = append(mycnf, "config/mycnf/master_mariadb.cnf") + case "MySQL80": + mycnf = append(mycnf, "config/mycnf/default-fast.cnf") + mycnf = append(mycnf, "config/mycnf/master_mysql80.cnf") case "MySQL56": mycnf = append(mycnf, "config/mycnf/default-fast.cnf") mycnf = append(mycnf, "config/mycnf/master_mysql56.cnf") diff --git a/py/vttest/mysql_flavor.py b/py/vttest/mysql_flavor.py index 2e9e3f95ff3..02183d3da8f 100644 --- a/py/vttest/mysql_flavor.py +++ b/py/vttest/mysql_flavor.py @@ -73,6 +73,15 @@ def my_cnf(self): ] return ":".join(files) +class MySQL80(MysqlFlavor): + """Overrides specific to MySQL 8.0.""" + + def my_cnf(self): + files = [ + os.path.join(vttop, "config/mycnf/default-fast.cnf"), + os.path.join(vttop, "config/mycnf/master_mysql80.cnf"), + ] + return ":".join(files) __mysql_flavor = None @@ -100,6 +109,8 @@ def set_mysql_flavor(flavor): __mysql_flavor = MariaDB() elif flavor == "MariaDB103": __mysql_flavor = MariaDB103() + elif flavor == "MySQL80": + __mysql_flavor = MySQL80() elif flavor == "MySQL56": __mysql_flavor = MySQL56() else: diff --git a/test/mysql_flavor.py b/test/mysql_flavor.py index 56fb9495055..bc6d484395c 100644 --- a/test/mysql_flavor.py +++ b/test/mysql_flavor.py @@ -137,7 +137,7 @@ def extra_my_cnf(self): return environment.vttop + "/config/mycnf/master_mariadb103.cnf" class MySQL56(MysqlFlavor): - """Overrides specific to MySQL 5.6.""" + """Overrides specific to MySQL 5.6/5.7""" def master_position(self, tablet): gtid = tablet.mquery("", "SELECT @@GLOBAL.gtid_executed")[0][0] @@ -165,6 +165,11 @@ def change_master_commands(self, host, port, pos): "MASTER_USER='vt_repl', MASTER_AUTO_POSITION = 1" % (host, port)] +class MySQL80(MySQL56): + """Overrides specific to MySQL 8.0.""" + def extra_my_cnf(self): + return environment.vttop + "/config/mycnf/master_mysql80.cnf" + # Map of registered MysqlFlavor classes (keyed by an identifier). flavor_map = {} @@ -238,3 +243,4 @@ def register_flavor(flavor, cls, env): register_flavor("MariaDB", MariaDB, "MariaDB") register_flavor("MariaDB103", MariaDB103, "MariaDB103") register_flavor("MySQL56", MySQL56, "MySQL56") +register_flavor("MySQL80", MySQL80, "MySQL80")