Skip to content

Commit 210cfc5

Browse files
abgohkyle
andcommitted
mysql-diag: do not recommend bootstrap with Synced but read-only nodes
When a cluster had all read-only nodes, even with a healthy cluster, mysql-diag was recommending a bootstrap operation. Since pxc-release now supports running in read-only mode this no longer makes sense. This commit stops recommending a bootstrap when the cluster is read-only [#186538357](https://www.pivotaltracker.com/story/show/186538357) Co-authored-by: Andrew Garner <[email protected]> Co-authored-by: Kyle Ong <[email protected]>
1 parent b044f53 commit 210cfc5

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/mysql-diag/database/bootstrappable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ func DoWeNeedBootstrap(gs []*GaleraStatus) bool {
1515
}
1616

1717
func isHealthy(status *GaleraStatus) bool {
18-
return status != nil && (status.LocalState == "Synced" || status.LocalState == "Donor/Desynced") && !status.ReadOnly
18+
return status != nil && (status.LocalState == "Synced" || status.LocalState == "Donor/Desynced")
1919
}

src/mysql-diag/database/bootstrappable_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package database_test
22

33
import (
4-
. "github.com/cloudfoundry/mysql-diag/database"
54
. "github.com/onsi/ginkgo"
65
. "github.com/onsi/gomega"
6+
7+
. "github.com/cloudfoundry/mysql-diag/database"
78
)
89

910
var _ = Describe("bootstrappable", func() {
@@ -47,10 +48,10 @@ var _ = Describe("bootstrappable", func() {
4748
})
4849
})
4950
Context("all nodes Synced but readonly", func() {
50-
It("is bootstrappable", func() {
51+
It("does not need bootstrap with any Synced nodes", func() {
5152
nodes := []*GaleraStatus{nodeSyncedReadOnly, nodeSyncedReadOnly, nodeSyncedReadOnly}
5253
needed := DoWeNeedBootstrap(nodes)
53-
Expect(needed).To(BeTrue())
54+
Expect(needed).To(BeFalse())
5455
})
5556
})
5657
Context("all nodes missing", func() {
@@ -61,17 +62,17 @@ var _ = Describe("bootstrappable", func() {
6162
})
6263
})
6364
Context("some nodes Joiner, some nodes Synced but readonly", func() {
64-
It("is bootstrappable", func() {
65+
It("does not need bootstrap with any Synced nodes", func() {
6566
nodes := []*GaleraStatus{nodeJoinerWritable, nodeSyncedReadOnly, nodeSyncedReadOnly}
6667
needed := DoWeNeedBootstrap(nodes)
67-
Expect(needed).To(BeTrue())
68+
Expect(needed).To(BeFalse())
6869
})
6970
})
7071
Context("some nodes Joiner, some nodes Synced but readonly, some nodes are missing", func() {
71-
It("is bootstrappable", func() {
72+
It("does not need bootstrap with any Synced nodes", func() {
7273
nodes := []*GaleraStatus{nodeJoinerWritable, nodeSyncedReadOnly, nil}
7374
needed := DoWeNeedBootstrap(nodes)
74-
Expect(needed).To(BeTrue())
75+
Expect(needed).To(BeFalse())
7576
})
7677
})
7778
})

0 commit comments

Comments
 (0)