Skip to content

Commit

Permalink
Backport to release-14.0: Adds RPCs to vttablet that vtorc requires (#…
Browse files Browse the repository at this point in the history
…10464) (#10546)

* Adds RPCs to vttablet that vtorc requires (#10464)

* feat: add vttablet rpc to reset replication parameters

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: added end to end testing for the rpc and fixed bug

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix typing error

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add basic full status rpc functionality and add test for it

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add all the fields needed in full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: moved the test to reparent tests and improved it

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: bug fix for no replication status and no primary status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add version to the full status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add binlog information to full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: fix the comment explaining the binlog information

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add semi-sync statuses to full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: call the correct command

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add server uuid and id to full status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: make server_id a uint32 to accept the correct range of values

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add few more fields to the full status like version comment, semi-sync settings, binlog_row_image

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: generate vtadmin proto files

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: add assertion to check binlog row format is read correctly

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: split GTID mode in its own function because mariadb doesn't support it

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: fix parsing of empty mariadb gtid set

Signed-off-by: Manan Gupta <manan@planetscale.com>

* docs: add doucmentation for existing fields in ReplicationStatus

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add relay log file position to the replication status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* test: augmented full status test to check all the different positions stored

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add additional fields to replication status and read source user

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read sql delay from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read ssl allowed from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read has replication filters from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: read auto position and using gtid from show replica status output

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: add replication lag unknown too to replication status

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: return nils from replication and primary postiion if it is not present

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: rename FileRelayLogPosition in replication status output to RelayLogSourceBinLogEquivalentPosition and augment test to make sure rpc changes are backward compatible

Signed-off-by: Manan Gupta <manan@planetscale.com>

* feat: update vtadmin proto files

Signed-off-by: Manan Gupta <manan@planetscale.com>

* refactor: rename BinLog to binlog in renamed proto field

Signed-off-by: Manan Gupta <manan@planetscale.com>

* lint: add a new line to proto file

Signed-off-by: Manan Gupta <manan@planetscale.com>
  • Loading branch information
GuptaManan100 committed Jun 22, 2022
1 parent 3241518 commit 3198c87
Show file tree
Hide file tree
Showing 42 changed files with 7,182 additions and 1,903 deletions.
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

0 comments on commit 3198c87

Please sign in to comment.