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 RPCs to vttablet that vtorc requires #10464

Merged
merged 33 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
055d82d
feat: add vttablet rpc to reset replication parameters
GuptaManan100 Jun 6, 2022
6d2ce60
feat: added end to end testing for the rpc and fixed bug
GuptaManan100 Jun 6, 2022
2753d1f
feat: fix typing error
GuptaManan100 Jun 6, 2022
37bfb37
feat: add basic full status rpc functionality and add test for it
GuptaManan100 Jun 6, 2022
6ba9581
feat: add all the fields needed in full status
GuptaManan100 Jun 7, 2022
7b6c9f3
test: moved the test to reparent tests and improved it
GuptaManan100 Jun 8, 2022
b6f6efd
feat: bug fix for no replication status and no primary status
GuptaManan100 Jun 8, 2022
e809210
feat: add version to the full status output
GuptaManan100 Jun 8, 2022
eb21eea
feat: add binlog information to full status
GuptaManan100 Jun 8, 2022
257d2be
docs: fix the comment explaining the binlog information
GuptaManan100 Jun 8, 2022
5ecbf37
feat: add semi-sync statuses to full status
GuptaManan100 Jun 8, 2022
e4e5ffc
Merge remote-tracking branch 'upstream/main' into vtorc-rpcs
GuptaManan100 Jun 8, 2022
9421c0b
feat: call the correct command
GuptaManan100 Jun 8, 2022
84ee60a
feat: add server uuid and id to full status
GuptaManan100 Jun 9, 2022
cbd4636
feat: make server_id a uint32 to accept the correct range of values
GuptaManan100 Jun 9, 2022
4c7cd0a
feat: add few more fields to the full status like version comment, se…
GuptaManan100 Jun 14, 2022
c3f23f4
feat: generate vtadmin proto files
GuptaManan100 Jun 14, 2022
30093bc
test: add assertion to check binlog row format is read correctly
GuptaManan100 Jun 14, 2022
39f6bce
feat: split GTID mode in its own function because mariadb doesn't sup…
GuptaManan100 Jun 15, 2022
34e08c4
feat: fix parsing of empty mariadb gtid set
GuptaManan100 Jun 15, 2022
7c6ce69
docs: add doucmentation for existing fields in ReplicationStatus
GuptaManan100 Jun 15, 2022
f43b24a
feat: add relay log file position to the replication status output
GuptaManan100 Jun 15, 2022
f62aa3e
test: augmented full status test to check all the different positions…
GuptaManan100 Jun 15, 2022
90c0d57
feat: add additional fields to replication status and read source user
GuptaManan100 Jun 15, 2022
e285b89
feat: read sql delay from show replica status output
GuptaManan100 Jun 15, 2022
cde93b8
feat: read ssl allowed from show replica status output
GuptaManan100 Jun 15, 2022
12924f1
feat: read has replication filters from show replica status output
GuptaManan100 Jun 15, 2022
dedc032
feat: read auto position and using gtid from show replica status output
GuptaManan100 Jun 15, 2022
c0c477c
feat: add replication lag unknown too to replication status
GuptaManan100 Jun 15, 2022
38392c3
feat: return nils from replication and primary postiion if it is not …
GuptaManan100 Jun 15, 2022
019825d
feat: rename FileRelayLogPosition in replication status output to Rel…
GuptaManan100 Jun 17, 2022
0c76e26
feat: update vtadmin proto files
GuptaManan100 Jun 17, 2022
4d1c5ec
refactor: rename BinLog to binlog in renamed proto field
GuptaManan100 Jun 20, 2022
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
63 changes: 61 additions & 2 deletions go/mysql/flavor.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ type flavor interface {
// primaryGTIDSet returns the current GTIDSet of a server.
primaryGTIDSet(c *Conn) (GTIDSet, error)

// purgedGTIDSet returns the purged GTIDSet of a server.
purgedGTIDSet(c *Conn) (GTIDSet, error)

// gtidMode returns the gtid mode of a server.
gtidMode(c *Conn) (string, error)

// serverUUID returns the UUID of a server.
serverUUID(c *Conn) (string, error)

// startReplicationCommand returns the command to start the replication.
startReplicationCommand() string

Expand Down Expand Up @@ -112,6 +121,10 @@ type flavor interface {
// replication on the host.
resetReplicationCommands(c *Conn) []string

// resetReplicationParametersCommands returns the commands to reset
// replication parameters on the host.
resetReplicationParametersCommands(c *Conn) []string

// setReplicationPositionCommands returns the commands to set the
// replication position at which the replica will resume.
setReplicationPositionCommands(pos Position) []string
Expand Down Expand Up @@ -266,6 +279,27 @@ func (c *Conn) PrimaryPosition() (Position, error) {
}, nil
}

// GetGTIDPurged returns the tablet's GTIDs which are purged.
func (c *Conn) GetGTIDPurged() (Position, error) {
gtidSet, err := c.flavor.purgedGTIDSet(c)
if err != nil {
return Position{}, err
}
return Position{
GTIDSet: gtidSet,
}, nil
}

// GetGTIDMode returns the tablet's GTID mode. Only available in MySQL flavour
func (c *Conn) GetGTIDMode() (string, error) {
return c.flavor.gtidMode(c)
}

// GetServerUUID returns the server's UUID.
func (c *Conn) GetServerUUID() (string, error) {
return c.flavor.serverUUID(c)
}

// PrimaryFilePosition returns the current primary's file based replication position.
func (c *Conn) PrimaryFilePosition() (Position, error) {
filePosFlavor := filePosFlavor{}
Expand Down Expand Up @@ -339,6 +373,12 @@ func (c *Conn) ResetReplicationCommands() []string {
return c.flavor.resetReplicationCommands(c)
}

// ResetReplicationParametersCommands returns the commands to reset
// replication parameters on the host.
func (c *Conn) ResetReplicationParametersCommands() []string {
return c.flavor.resetReplicationParametersCommands(c)
}

// SetReplicationPositionCommands returns the commands to set the
// replication position at which the replica will resume
// when it is later reparented with SetReplicationSourceCommand.
Expand Down Expand Up @@ -402,7 +442,12 @@ func parseReplicationStatus(fields map[string]string) ReplicationStatus {
// The field names in the map are identical to what we receive from the database
// Hence the names still contain Master
status := ReplicationStatus{
SourceHost: fields["Master_Host"],
SourceHost: fields["Master_Host"],
SourceUser: fields["Master_User"],
SSLAllowed: fields["Master_SSL_Allowed"] == "Yes",
AutoPosition: fields["Auto_Position"] == "1",
UsingGTID: fields["Using_Gtid"] != "No" && fields["Using_Gtid"] != "",
HasReplicationFilters: (fields["Replicate_Do_DB"] != "") || (fields["Replicate_Ignore_DB"] != "") || (fields["Replicate_Do_Table"] != "") || (fields["Replicate_Ignore_Table"] != "") || (fields["Replicate_Wild_Do_Table"] != "") || (fields["Replicate_Wild_Ignore_Table"] != ""),
// These fields are returned from the underlying DB and cannot be renamed
IOState: ReplicationStatusToState(fields["Slave_IO_Running"]),
LastIOError: fields["Last_IO_Error"],
Expand All @@ -424,6 +469,8 @@ func parseReplicationStatus(fields map[string]string) ReplicationStatus {
}
parseUint, _ = strconv.ParseUint(fields["Master_Server_Id"], 10, 0)
status.SourceServerID = uint(parseUint)
parseUint, _ = strconv.ParseUint(fields["SQL_Delay"], 10, 0)
status.SQLDelay = uint(parseUint)

executedPosStr := fields["Exec_Master_Log_Pos"]
file := fields["Relay_Master_Log_File"]
Expand All @@ -442,12 +489,24 @@ func parseReplicationStatus(fields map[string]string) ReplicationStatus {
if file != "" && readPosStr != "" {
fileRelayPos, err := strconv.Atoi(readPosStr)
if err == nil {
status.FileRelayLogPosition.GTIDSet = filePosGTID{
status.RelayLogSourceBinlogEquivalentPosition.GTIDSet = filePosGTID{
file: file,
pos: fileRelayPos,
}
}
}

relayPosStr := fields["Relay_Log_Pos"]
file = fields["Relay_Log_File"]
if file != "" && relayPosStr != "" {
relayFilePos, err := strconv.Atoi(relayPosStr)
if err == nil {
status.RelayLogFilePosition.GTIDSet = filePosGTID{
file: file,
pos: relayFilePos,
}
}
}
return status
}

Expand Down
43 changes: 41 additions & 2 deletions go/mysql/flavor_filepos.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ limitations under the License.
package mysql

import (
"context"
"fmt"
"io"
"strconv"
"strings"
"time"

"context"
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
"vitess.io/vitess/go/vt/vterrors"
)

type filePosFlavor struct {
Expand Down Expand Up @@ -62,6 +64,36 @@ func (flv *filePosFlavor) primaryGTIDSet(c *Conn) (GTIDSet, error) {
}, nil
}

// purgedGTIDSet is part of the Flavor interface.
func (flv *filePosFlavor) purgedGTIDSet(c *Conn) (GTIDSet, error) {
return nil, nil
}

// gtidMode is part of the Flavor interface.
func (flv *filePosFlavor) gtidMode(c *Conn) (string, error) {
qr, err := c.ExecuteFetch("select @@global.gtid_mode", 1, false)
if err != nil {
return "", err
}
if len(qr.Rows) != 1 || len(qr.Rows[0]) != 1 {
return "", vterrors.Errorf(vtrpcpb.Code_INTERNAL, "unexpected result format for gtid_mode: %#v", qr)
}
return qr.Rows[0][0].ToString(), nil
}

// serverUUID is part of the Flavor interface.
func (flv *filePosFlavor) serverUUID(c *Conn) (string, error) {
// keep @@global as lowercase, as some servers like the Ripple binlog server only honors a lowercase `global` value
qr, err := c.ExecuteFetch("SELECT @@global.server_uuid", 1, false)
if err != nil {
return "", err
}
if len(qr.Rows) != 1 || len(qr.Rows[0]) != 1 {
return "", vterrors.Errorf(vtrpcpb.Code_INTERNAL, "unexpected result format for server_uuid: %#v", qr)
}
return qr.Rows[0][0].ToString(), nil
}

func (flv *filePosFlavor) startReplicationCommand() string {
return "unsupported"
}
Expand Down Expand Up @@ -183,6 +215,13 @@ func (flv *filePosFlavor) resetReplicationCommands(c *Conn) []string {
}
}

// resetReplicationParametersCommands is part of the Flavor interface.
func (flv *filePosFlavor) resetReplicationParametersCommands(c *Conn) []string {
return []string{
"unsupported",
}
}

// setReplicationPositionCommands is part of the Flavor interface.
func (flv *filePosFlavor) setReplicationPositionCommands(pos Position) []string {
return []string{
Expand Down Expand Up @@ -219,7 +258,7 @@ func parseFilePosReplicationStatus(resultMap map[string]string) (ReplicationStat
status := parseReplicationStatus(resultMap)

status.Position = status.FilePosition
status.RelayLogPosition = status.FileRelayLogPosition
status.RelayLogPosition = status.RelayLogSourceBinlogEquivalentPosition

return status, nil
}
Expand Down
16 changes: 10 additions & 6 deletions go/mysql/flavor_filepos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,26 @@ func TestFilePosRetrieveExecutedPosition(t *testing.T) {
"Relay_Master_Log_File": "master-bin.000002",
"Read_Master_Log_Pos": "1308",
"Master_Log_File": "master-bin.000003",
"Relay_Log_Pos": "1309",
"Relay_Log_File": "relay-bin.000004",
}

want := ReplicationStatus{
Position: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
RelayLogPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
FilePosition: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
FileRelayLogPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
Position: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
RelayLogPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
FilePosition: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
RelayLogSourceBinlogEquivalentPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
RelayLogFilePosition: Position{GTIDSet: filePosGTID{file: "relay-bin.000004", pos: 1309}},
}
got, err := parseFilePosReplicationStatus(resultMap)
require.NoError(t, err)
assert.Equalf(t, got.Position.GTIDSet, want.Position.GTIDSet, "got Position: %v; want Position: %v", got.Position.GTIDSet, want.Position.GTIDSet)
assert.Equalf(t, got.RelayLogPosition.GTIDSet, want.RelayLogPosition.GTIDSet, "got RelayLogPosition: %v; want RelayLogPosition: %v", got.RelayLogPosition.GTIDSet, want.RelayLogPosition.GTIDSet)
assert.Equalf(t, got.RelayLogFilePosition.GTIDSet, want.RelayLogFilePosition.GTIDSet, "got RelayLogFilePosition: %v; want RelayLogFilePosition: %v", got.RelayLogFilePosition.GTIDSet, want.RelayLogFilePosition.GTIDSet)
assert.Equalf(t, got.FilePosition.GTIDSet, want.FilePosition.GTIDSet, "got FilePosition: %v; want FilePosition: %v", got.FilePosition.GTIDSet, want.FilePosition.GTIDSet)
assert.Equalf(t, got.FileRelayLogPosition.GTIDSet, want.FileRelayLogPosition.GTIDSet, "got FileRelayLogPosition: %v; want FileRelayLogPosition: %v", got.FileRelayLogPosition.GTIDSet, want.FileRelayLogPosition.GTIDSet)
assert.Equalf(t, got.RelayLogSourceBinlogEquivalentPosition.GTIDSet, want.RelayLogSourceBinlogEquivalentPosition.GTIDSet, "got RelayLogSourceBinlogEquivalentPosition: %v; want RelayLogSourceBinlogEquivalentPosition: %v", got.RelayLogSourceBinlogEquivalentPosition.GTIDSet, want.RelayLogSourceBinlogEquivalentPosition.GTIDSet)
assert.Equalf(t, got.Position.GTIDSet, got.FilePosition.GTIDSet, "FilePosition and Position don't match when they should for the FilePos flavor")
assert.Equalf(t, got.RelayLogPosition.GTIDSet, got.FileRelayLogPosition.GTIDSet, "RelayLogPosition and FileRelayLogPosition don't match when they should for the FilePos flavor")
assert.Equalf(t, got.RelayLogPosition.GTIDSet, got.RelayLogSourceBinlogEquivalentPosition.GTIDSet, "RelayLogPosition and RelayLogSourceBinlogEquivalentPosition don't match when they should for the FilePos flavor")
}

func TestFilePosShouldGetPosition(t *testing.T) {
Expand Down
23 changes: 23 additions & 0 deletions go/mysql/flavor_mariadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ func (mariadbFlavor) primaryGTIDSet(c *Conn) (GTIDSet, error) {
return parseMariadbGTIDSet(qr.Rows[0][0].ToString())
}

// purgedGTIDSet is part of the Flavor interface.
func (mariadbFlavor) purgedGTIDSet(c *Conn) (GTIDSet, error) {
return nil, nil
}

// serverUUID is part of the Flavor interface.
func (mariadbFlavor) serverUUID(c *Conn) (string, error) {
return "", nil
}

// gtidMode is part of the Flavor interface.
func (mariadbFlavor) gtidMode(c *Conn) (string, error) {
return "", nil
}

func (mariadbFlavor) startReplicationUntilAfter(pos Position) string {
return fmt.Sprintf("START SLAVE UNTIL master_gtid_pos = \"%s\"", pos)
}
Expand Down Expand Up @@ -130,6 +145,14 @@ func (mariadbFlavor) resetReplicationCommands(c *Conn) []string {
return resetCommands
}

// resetReplicationParametersCommands is part of the Flavor interface.
func (mariadbFlavor) resetReplicationParametersCommands(c *Conn) []string {
resetCommands := []string{
"RESET SLAVE ALL", // "ALL" makes it forget source host:port.
}
return resetCommands
}

// setReplicationPositionCommands is part of the Flavor interface.
func (mariadbFlavor) setReplicationPositionCommands(pos Position) []string {
return []string{
Expand Down
10 changes: 7 additions & 3 deletions go/mysql/flavor_mariadb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,20 @@ func TestMariadbRetrieveFileBasedPositions(t *testing.T) {
"Read_Master_Log_Pos": "1308",
"Master_Log_File": "master-bin.000003",
"Gtid_Slave_Pos": "0-101-2320",
"Relay_Log_Pos": "1309",
"Relay_Log_File": "relay-bin.000004",
}

want := ReplicationStatus{
FilePosition: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
FileRelayLogPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
FilePosition: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
RelayLogSourceBinlogEquivalentPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
RelayLogFilePosition: Position{GTIDSet: filePosGTID{file: "relay-bin.000004", pos: 1309}},
}
got, err := parseMariadbReplicationStatus(resultMap)
require.NoError(t, err)
assert.Equalf(t, got.RelayLogFilePosition.GTIDSet, want.RelayLogFilePosition.GTIDSet, "got RelayLogFilePosition: %v; want RelayLogFilePosition: %v", got.RelayLogFilePosition.GTIDSet, want.RelayLogFilePosition.GTIDSet)
assert.Equal(t, got.FilePosition.GTIDSet, want.FilePosition.GTIDSet, fmt.Sprintf("got FilePosition: %v; want FilePosition: %v", got.FilePosition.GTIDSet, want.FilePosition.GTIDSet))
assert.Equal(t, got.FileRelayLogPosition.GTIDSet, want.FileRelayLogPosition.GTIDSet, fmt.Sprintf("got FileRelayLogPosition: %v; want FileRelayLogPosition: %v", got.FileRelayLogPosition.GTIDSet, want.FileRelayLogPosition.GTIDSet))
assert.Equal(t, got.RelayLogSourceBinlogEquivalentPosition.GTIDSet, want.RelayLogSourceBinlogEquivalentPosition.GTIDSet, fmt.Sprintf("got RelayLogSourceBinlogEquivalentPosition: %v; want RelayLogSourceBinlogEquivalentPosition: %v", got.RelayLogSourceBinlogEquivalentPosition.GTIDSet, want.RelayLogSourceBinlogEquivalentPosition.GTIDSet))
}

func TestMariadbShouldGetNilRelayLogPosition(t *testing.T) {
Expand Down
46 changes: 46 additions & 0 deletions go/mysql/flavor_mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,44 @@ func (mysqlFlavor) primaryGTIDSet(c *Conn) (GTIDSet, error) {
return parseMysql56GTIDSet(qr.Rows[0][0].ToString())
}

// purgedGTIDSet is part of the Flavor interface.
func (mysqlFlavor) purgedGTIDSet(c *Conn) (GTIDSet, error) {
// keep @@global as lowercase, as some servers like the Ripple binlog server only honors a lowercase `global` value
qr, err := c.ExecuteFetch("SELECT @@global.gtid_purged", 1, false)
if err != nil {
return nil, err
}
if len(qr.Rows) != 1 || len(qr.Rows[0]) != 1 {
return nil, vterrors.Errorf(vtrpc.Code_INTERNAL, "unexpected result format for gtid_purged: %#v", qr)
}
return parseMysql56GTIDSet(qr.Rows[0][0].ToString())
}

// serverUUID is part of the Flavor interface.
func (mysqlFlavor) serverUUID(c *Conn) (string, error) {
// keep @@global as lowercase, as some servers like the Ripple binlog server only honors a lowercase `global` value
qr, err := c.ExecuteFetch("SELECT @@global.server_uuid", 1, false)
if err != nil {
return "", err
}
if len(qr.Rows) != 1 || len(qr.Rows[0]) != 1 {
return "", vterrors.Errorf(vtrpc.Code_INTERNAL, "unexpected result format for server_uuid: %#v", qr)
}
return qr.Rows[0][0].ToString(), nil
}

// gtidMode is part of the Flavor interface.
func (mysqlFlavor) gtidMode(c *Conn) (string, error) {
qr, err := c.ExecuteFetch("select @@global.gtid_mode", 1, false)
if err != nil {
return "", err
}
if len(qr.Rows) != 1 || len(qr.Rows[0]) != 1 {
return "", vterrors.Errorf(vtrpc.Code_INTERNAL, "unexpected result format for gtid_mode: %#v", qr)
}
return qr.Rows[0][0].ToString(), nil
}

func (mysqlFlavor) startReplicationCommand() string {
return "START SLAVE"
}
Expand Down Expand Up @@ -117,6 +155,14 @@ func (mysqlFlavor) resetReplicationCommands(c *Conn) []string {
return resetCommands
}

// resetReplicationParametersCommands is part of the Flavor interface.
func (mysqlFlavor) resetReplicationParametersCommands(c *Conn) []string {
resetCommands := []string{
"RESET SLAVE ALL", // "ALL" makes it forget source host:port.
}
return resetCommands
}

// setReplicationPositionCommands is part of the Flavor interface.
func (mysqlFlavor) setReplicationPositionCommands(pos Position) []string {
return []string{
Expand Down
10 changes: 7 additions & 3 deletions go/mysql/flavor_mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,20 @@ func TestMysqlRetrieveFileBasedPositions(t *testing.T) {
"Relay_Master_Log_File": "master-bin.000002",
"Read_Master_Log_Pos": "1308",
"Master_Log_File": "master-bin.000003",
"Relay_Log_Pos": "1309",
"Relay_Log_File": "relay-bin.000004",
}

want := ReplicationStatus{
FilePosition: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
FileRelayLogPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
FilePosition: Position{GTIDSet: filePosGTID{file: "master-bin.000002", pos: 1307}},
RelayLogSourceBinlogEquivalentPosition: Position{GTIDSet: filePosGTID{file: "master-bin.000003", pos: 1308}},
RelayLogFilePosition: Position{GTIDSet: filePosGTID{file: "relay-bin.000004", pos: 1309}},
}
got, err := parseMysqlReplicationStatus(resultMap)
require.NoError(t, err)
assert.Equalf(t, got.FilePosition.GTIDSet, want.FilePosition.GTIDSet, "got FilePosition: %v; want FilePosition: %v", got.FilePosition.GTIDSet, want.FilePosition.GTIDSet)
assert.Equalf(t, got.FileRelayLogPosition.GTIDSet, want.FileRelayLogPosition.GTIDSet, "got FileRelayLogPosition: %v; want FileRelayLogPosition: %v", got.FileRelayLogPosition.GTIDSet, want.FileRelayLogPosition.GTIDSet)
assert.Equalf(t, got.RelayLogFilePosition.GTIDSet, want.RelayLogFilePosition.GTIDSet, "got RelayLogFilePosition: %v; want RelayLogFilePosition: %v", got.RelayLogFilePosition.GTIDSet, want.RelayLogFilePosition.GTIDSet)
assert.Equalf(t, got.RelayLogSourceBinlogEquivalentPosition.GTIDSet, want.RelayLogSourceBinlogEquivalentPosition.GTIDSet, "got RelayLogSourceBinlogEquivalentPosition: %v; want RelayLogSourceBinlogEquivalentPosition: %v", got.RelayLogSourceBinlogEquivalentPosition.GTIDSet, want.RelayLogSourceBinlogEquivalentPosition.GTIDSet)
}

func TestMysqlShouldGetRelayLogPosition(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions go/mysql/flavor_mysqlgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ func (mysqlGRFlavor) resetReplicationCommands(c *Conn) []string {
return []string{}
}

// resetReplicationParametersCommands is part of the Flavor interface.
func (mysqlGRFlavor) resetReplicationParametersCommands(c *Conn) []string {
return []string{}
}

// setReplicationPositionCommands is disabled in mysqlGRFlavor
func (mysqlGRFlavor) setReplicationPositionCommands(pos Position) []string {
return []string{}
Expand Down
4 changes: 4 additions & 0 deletions go/mysql/mariadb_gtid.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ func parseMariadbGTIDSet(s string) (GTIDSet, error) {
gtidStrings := strings.Split(s, ",")
gtidSet := make(MariadbGTIDSet, len(gtidStrings))
for _, gtidString := range gtidStrings {
gtidString = strings.TrimSpace(gtidString)
if gtidString == "" {
continue
}
gtid, err := parseMariadbGTID(gtidString)
if err != nil {
return nil, err
Expand Down
Loading