forked from signal18/replication-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_switchover_assync_longquery_norplcheck.go
45 lines (36 loc) · 1.3 KB
/
test_switchover_assync_longquery_norplcheck.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
// 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 (
"time"
"github.com/signal18/replication-manager/cluster"
"github.com/signal18/replication-manager/dbhelper"
)
func testSwitchoverLongQueryNoRplCheckNoSemiSync(cluster *cluster.Cluster, conf string, test *cluster.Test) bool {
cluster.SetRplChecks(false)
cluster.SetRplMaxDelay(8)
err := cluster.DisableSemisync()
if err != nil {
cluster.LogPrintf(LvlErr, "%s", err)
return false
}
SaveMasterURL := cluster.GetMaster().URL
go dbhelper.InjectLongTrx(cluster.GetMaster().Conn, 20)
cluster.LogPrintf("TEST", "Master is %s", cluster.GetMaster().URL)
cluster.SwitchoverWaitTest()
cluster.LogPrintf("TEST", "New Master %s ", cluster.GetMaster().URL)
time.Sleep(20 * time.Second)
err = cluster.EnableSemisync()
if err != nil {
cluster.LogPrintf(LvlErr, "%s", err)
return false
}
if cluster.GetMaster().URL != SaveMasterURL {
cluster.LogPrintf(LvlErr, "Saved Prefered master %s <> from saved %s ", SaveMasterURL, cluster.GetMaster().URL)
return false
}
return true
}