Skip to content
Merged
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
2 changes: 1 addition & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
38 changes: 38 additions & 0 deletions config/mycnf/master_mysql80.cnf
Original file line number Diff line number Diff line change
@@ -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
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

is this something we can delete for 8.0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

according to the manual you still need the plugin in mysql 8.0

https://dev.mysql.com/doc/refman/8.0/en/replication-semisync-installation.html


# 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
2 changes: 1 addition & 1 deletion docker/bootstrap/Dockerfile.mysql80
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions go/vt/mysqlctl/mysqld.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions go/vt/vttest/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
11 changes: 11 additions & 0 deletions py/vttest/mysql_flavor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion test/mysql_flavor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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")