forked from signal18/replication-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_failover_semisync_autorejoin_flashback.go
54 lines (44 loc) · 1.43 KB
/
test_failover_semisync_autorejoin_flashback.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// replication-manager - Replication Manager Monitoring and CLI for MariaDB and MySQL
// Copyright 2017 Signal 18 SARL
// Authors: Guillaume Lefranc <guillaume@signal18.io>
// Stephane Varoqui <svaroqui@gmail.com>
// This source code is licensed under the GNU General Public License, version 3.
package regtest
import (
"sync"
"time"
"github.com/signal18/replication-manager/cluster"
)
func testFailoverSemisyncAutoRejoinFlashback(cluster *cluster.Cluster, conf string, test *cluster.Test) bool {
cluster.SetFailSync(false)
cluster.SetInteractive(false)
cluster.SetRplChecks(false)
cluster.SetRejoin(true)
cluster.SetRejoinFlashback(true)
cluster.SetRejoinDump(false)
SaveMasterURL := cluster.GetMaster().URL
SaveMaster := cluster.GetMaster()
//clusteruster.DelayAllSlaves()
cluster.PrepareBench()
//go clusteruster.RunBench()
go cluster.RunSysbench()
time.Sleep(4 * time.Second)
cluster.FailoverAndWait()
/// give time to start the failover
if cluster.GetMaster().URL == SaveMasterURL {
cluster.LogPrintf("TEST", "Old master %s == Next master %s ", SaveMasterURL, cluster.GetMaster().URL)
return false
}
cluster.RunSysbench()
wg2 := new(sync.WaitGroup)
wg2.Add(1)
go cluster.WaitRejoin(wg2)
cluster.StartDatabaseService(SaveMaster)
wg2.Wait()
SaveMaster.ReadAllRelayLogs()
if cluster.CheckTableConsistency("test.sbtest") != true {
cluster.LogPrintf(LvlErr, "Inconsitant slave")
return false
}
return true
}