Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b6987f7
Add capability create consistent transactions
Sep 17, 2018
d7cb371
Always restart the engine when changing server type
Dec 3, 2018
1468d91
Restore tests removed by mistake
Dec 17, 2018
bee8e6e
Fix unit test
Dec 17, 2018
bdb292e
Move logic of state transitions into the tx engine.
Dec 19, 2018
9612e40
more better tests
Dec 27, 2018
dfa9126
Make the tablet server stop keeping track of the tx engine state
Dec 27, 2018
03de7e4
Minor work on tx_engine
Dec 28, 2018
549c161
Minor refactorings
Jan 8, 2019
aaa4dde
tabletserver.go now uses the TxEngineStateController interface instea…
Jan 8, 2019
4bc7937
Moved the beginRequests waitGroup into the tx_engine
Jan 8, 2019
6393b07
Better naming and comments
Jan 8, 2019
a57c799
Split test file in two to get around test harness problem
Jan 10, 2019
505458f
Make sure to stop race condititions
Jan 10, 2019
018ca33
Removed boolean flag that was not needed any more
Jan 10, 2019
c3db459
Make all state transitions blocking
Jan 10, 2019
5785cdd
Don't touch the internals unnecessarily
Jan 11, 2019
1ee033c
Prepare tests for read only transactions
Jan 11, 2019
e0e52e5
Moving code around to make it easier to read
Jan 11, 2019
fabc520
Reject write transactions when in read only mode
Jan 11, 2019
f99a185
Make sure the schema engine is initialized
Jan 11, 2019
caaad26
Check for null
Jan 11, 2019
1f5524d
Merge remote-tracking branch 'upstream/master' into lock-tables
Jan 14, 2019
611ec92
Revert "Split test file in two to get around test harness problem"
Jan 14, 2019
37c25bb
Merge remote-tracking branch 'upstream/master' into lock-tables
Jan 14, 2019
830917d
Comments
Jan 14, 2019
05826a1
Return tx_engine to the old behaviours of rolling back transactions
Jan 15, 2019
3966d01
Minor refactoring
Jan 15, 2019
6626e4d
Merge remote-tracking branch 'upstream/master' into lock-tables
Jan 15, 2019
20ba0f5
Continue restoring the old behaviour back
Jan 15, 2019
4fafca8
temp fix for tx pool hang
sougou Jan 17, 2019
79f7894
Make sure to not start 2PC when in read-only mode
Jan 17, 2019
fe00e51
Merge remote-tracking branch 'upstream/master' into lock-tables
Jan 17, 2019
d9882d8
Clean up test code
Jan 18, 2019
3c5b742
Fix compilation error
Jan 18, 2019
16a95a3
Fix data race
Jan 18, 2019
21303bb
Test code clean up
Jan 18, 2019
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
9 changes: 9 additions & 0 deletions go/mysql/flavor.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ type flavor interface {
// startSlave returns the command to start the slave.
startSlaveCommand() string

// startSlaveUntilAfter will restart replication, but only allow it
// to run until `pos` is reached. After reaching pos, replication will be stopped again
startSlaveUntilAfter(pos Position) string

// stopSlave returns the command to stop the slave.
stopSlaveCommand() string

Expand Down Expand Up @@ -146,6 +150,11 @@ func (c *Conn) StartSlaveCommand() string {
return c.flavor.startSlaveCommand()
}

// StartSlaveUntilAfterCommand returns the command to start the slave.
func (c *Conn) StartSlaveUntilAfterCommand(pos Position) string {
return c.flavor.startSlaveUntilAfter(pos)
}

// StopSlaveCommand returns the command to stop the slave.
func (c *Conn) StopSlaveCommand() string {
return c.flavor.stopSlaveCommand()
Expand Down
4 changes: 4 additions & 0 deletions go/mysql/flavor_mariadb.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func (mariadbFlavor) masterGTIDSet(c *Conn) (GTIDSet, error) {
return parseMariadbGTIDSet(qr.Rows[0][0].ToString())
}

func (mariadbFlavor) startSlaveUntilAfter(pos Position) string {
return fmt.Sprintf("START SLAVE UNTIL master_gtid_pos = \"%s\"", pos)
}

func (mariadbFlavor) startSlaveCommand() string {
return "START SLAVE"
}
Expand Down
4 changes: 4 additions & 0 deletions go/mysql/flavor_mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func (mysqlFlavor) startSlaveCommand() string {
return "START SLAVE"
}

func (mysqlFlavor) startSlaveUntilAfter(pos Position) string {
return fmt.Sprintf("START SLAVE UNTIL SQL_AFTER_GTIDS = '%s'", pos)
}

func (mysqlFlavor) stopSlaveCommand() string {
return "STOP SLAVE"
}
Expand Down
14 changes: 14 additions & 0 deletions go/vt/mysqlctl/fakemysqldaemon/fakemysqldaemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ type FakeMysqlDaemon struct {
// If it doesn't match, SetSlavePosition will return an error.
SetSlavePositionPos mysql.Position

// StartSlaveUntilAfterPos is matched against the input
StartSlaveUntilAfterPos mysql.Position

// SetMasterInput is matched against the input of SetMaster
// (as "%v:%v"). If it doesn't match, SetMaster will return an error.
SetMasterInput string
Expand Down Expand Up @@ -240,6 +243,17 @@ func (fmd *FakeMysqlDaemon) StartSlave(hookExtraEnv map[string]string) error {
})
}

// StartSlaveUntilAfter is part of the MysqlDaemon interface.
func (fmd *FakeMysqlDaemon) StartSlaveUntilAfter(ctx context.Context, pos mysql.Position) error {
if !reflect.DeepEqual(fmd.StartSlaveUntilAfterPos, pos) {
return fmt.Errorf("wrong pos for StartSlaveUntilAfter: expected %v got %v", fmd.SetSlavePositionPos, pos)
}

return fmd.ExecuteSuperQueryList(context.Background(), []string{
"START SLAVE UNTIL AFTER",
})
}

// StopSlave is part of the MysqlDaemon interface.
func (fmd *FakeMysqlDaemon) StopSlave(hookExtraEnv map[string]string) error {
return fmd.ExecuteSuperQueryList(context.Background(), []string{
Expand Down
1 change: 1 addition & 0 deletions go/vt/mysqlctl/mysql_daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type MysqlDaemon interface {

// replication related methods
StartSlave(hookExtraEnv map[string]string) error
StartSlaveUntilAfter(ctx context.Context, pos mysql.Position) error
StopSlave(hookExtraEnv map[string]string) error
SlaveStatus() (mysql.SlaveStatus, error)
SetSemiSyncEnabled(master, slave bool) error
Expand Down
13 changes: 13 additions & 0 deletions go/vt/mysqlctl/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@ func (mysqld *Mysqld) StartSlave(hookExtraEnv map[string]string) error {
return h.ExecuteOptional()
}

// StartSlaveUntilAfter starts a slave until replication has come to `targetPos`, then it stops replication
func (mysqld *Mysqld) StartSlaveUntilAfter(ctx context.Context, targetPos mysql.Position) error {
conn, err := getPoolReconnect(ctx, mysqld.dbaPool)
if err != nil {
return err
}
defer conn.Recycle()

queries := []string{conn.StartSlaveUntilAfterCommand(targetPos)}

return mysqld.executeSuperQueryListConn(ctx, conn, queries)
}

// StopSlave stops a slave.
func (mysqld *Mysqld) StopSlave(hookExtraEnv map[string]string) error {
h := hook.NewSimpleHook("preflight_stop_slave")
Expand Down
Loading