Skip to content

Commit

Permalink
Allow MySQL56 flavor to accept MySQL 5.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
enisoc committed May 21, 2016
1 parent f8ba1f8 commit dea4eb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ if [ -z "$MYSQL_FLAVOR" ]; then
fi
case "$MYSQL_FLAVOR" in
"MySQL56")
myversion=`$VT_MYSQL_ROOT/bin/mysql --version | grep 'Distrib 5\.6'`
[ "$myversion" != "" ] || 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."
myversion=`$VT_MYSQL_ROOT/bin/mysql --version`
[[ "$myversion" =~ Distrib\ 5\.[67] ]] || 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."
;;

"MariaDB")
myversion=`$VT_MYSQL_ROOT/bin/mysql --version | grep MariaDB`
[ "$myversion" != "" ] || fail "Couldn't find MariaDB in $VT_MYSQL_ROOT. Set VT_MYSQL_ROOT to override search location."
myversion=`$VT_MYSQL_ROOT/bin/mysql --version`
[[ "$myversion" =~ MariaDB ]] || fail "Couldn't find MariaDB in $VT_MYSQL_ROOT. Set VT_MYSQL_ROOT to override search location."
echo "Found MariaDB installation in $VT_MYSQL_ROOT."
;;

Expand All @@ -179,9 +179,10 @@ echo "$MYSQL_FLAVOR" > $VTROOT/dist/MYSQL_FLAVOR
[ -x $VT_MYSQL_ROOT/bin/mysql_config ] || fail "Cannot execute $VT_MYSQL_ROOT/bin/mysql_config. Did you install a client dev package?"

cp $VTTOP/config/gomysql.pc.tmpl $VTROOT/lib/gomysql.pc
echo "Version:" "$($VT_MYSQL_ROOT/bin/mysql_config --version)" >> $VTROOT/lib/gomysql.pc
myversion=`$VT_MYSQL_ROOT/bin/mysql_config --version`
echo "Version:" "$myversion" >> $VTROOT/lib/gomysql.pc
echo "Cflags:" "$($VT_MYSQL_ROOT/bin/mysql_config --cflags) -ggdb -fPIC" >> $VTROOT/lib/gomysql.pc
if [ "$MYSQL_FLAVOR" == "MariaDB" ]; then
if [[ "$MYSQL_FLAVOR" == "MariaDB" || "$myversion" =~ ^5\.7\. ]]; then
# Use static linking because the shared library doesn't export
# some internal functions we use, like cli_safe_read.
echo "Libs:" "$($VT_MYSQL_ROOT/bin/mysql_config --libs_r | sed -r 's,-lmysqlclient(_r)?,-l:libmysqlclient.a -lstdc++,')" >> $VTROOT/lib/gomysql.pc
Expand Down
4 changes: 2 additions & 2 deletions go/vt/mysqlctl/mysql_flavor_mysql56.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import (
"github.com/youtube/vitess/go/vt/mysqlctl/replication"
)

// mysql56 is the implementation of MysqlFlavor for MySQL 5.6.
// mysql56 is the implementation of MysqlFlavor for MySQL 5.6+.
type mysql56 struct {
}

const mysql56FlavorID = "MySQL56"

// VersionMatch implements MysqlFlavor.VersionMatch().
func (*mysql56) VersionMatch(version string) bool {
return strings.HasPrefix(version, "5.6")
return strings.HasPrefix(version, "5.6") || strings.HasPrefix(version, "5.7")
}

// MasterPosition implements MysqlFlavor.MasterPosition().
Expand Down

0 comments on commit dea4eb2

Please sign in to comment.