Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 57e92d9

Browse files
author
Matthieu`
committed
Removed the GTID field from the GaleraState struct
As we're still not sure what to do on the operator side with the GTID we decided to not export it in the `GaleraState`. It would also force us to import the `GaleraState` struct to the operator repository so we chose to just not export it for the moment instead. https://mariadb-operator.slack.com/archives/C056RAECH0W/p1699990598511999?thread_ts=1699350363.009529&cid=C056RAECH0W
1 parent b1f9ef6 commit 57e92d9

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

pkg/galera/galera.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ type GaleraState struct {
3636
Version string `json:"version"`
3737
UUID string `json:"uuid"`
3838
Seqno int `json:"seqno"`
39-
GTID *GTID `json:"gtid"`
4039
SafeToBootstrap bool `json:"safeToBootstrap"`
4140
}
4241

@@ -74,14 +73,13 @@ func (g *GaleraState) MarshalText() ([]byte, error) {
7473
}
7574
tpl := createTpl("grastate.dat", `version: {{ .Version }}
7675
uuid: {{ .UUID }}
77-
seqno: {{ .Seqno }}{{ if .GTID }},{{ .GTID }}{{ end }}
76+
seqno: {{ .Seqno }}
7877
safe_to_bootstrap: {{ .SafeToBootstrap }}`)
7978
buf := new(bytes.Buffer)
8079
err := tpl.Execute(buf, tplOpts{
8180
Version: g.Version,
8281
UUID: g.UUID,
8382
Seqno: g.Seqno,
84-
GTID: g.GTID,
8583
SafeToBootstrap: func() int {
8684
if g.SafeToBootstrap {
8785
return 1
@@ -125,15 +123,17 @@ func (g *GaleraState) UnmarshalText(text []byte) error {
125123
uuid = &value
126124
case "seqno":
127125
// When the `wsrep_gtid_mode` is set to `ON`, the `seqno` is
128-
// actually a string of the form `seqno,gtid`.
126+
// actually a string of the form `<seqno>,<gtid>`.
127+
//
128+
// For the moment we only care about the `seqno` part as we're
129+
// still not sure about what to do with the `gtid`.
129130
seqnoStr, gtidStr, found := strings.Cut(value, ",")
130131
if found {
131132
gtid = &GTID{}
132133
err := gtid.UnmarshalText([]byte(gtidStr))
133134
if err != nil {
134135
return fmt.Errorf("error parsing gtid: %v", err)
135136
}
136-
137137
}
138138
i, err := strconv.Atoi(seqnoStr)
139139
if err != nil {
@@ -158,10 +158,6 @@ func (g *GaleraState) UnmarshalText(text []byte) error {
158158
g.Version = *version
159159
g.UUID = *uuid
160160
g.Seqno = *seqno
161-
// Only set the GTID if it was found in the file.
162-
if gtid != nil {
163-
g.GTID = gtid
164-
}
165161
g.SafeToBootstrap = *safeToBootstrap
166162
return nil
167163
}

pkg/galera/galera_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ safe_to_bootstrap: 0`,
7171
Version: "2.1",
7272
UUID: "05f061bd-02a3-11ee-857c-aa370ff6666b",
7373
Seqno: 1,
74-
GTID: &GTID{DomainID: 0, ServerID: 1, SequenceNumber: 2},
7574
SafeToBootstrap: true,
7675
},
7776
want: `version: 2.1
@@ -242,7 +241,6 @@ safe_to_bootstrap: 1`),
242241
Version: "2.1",
243242
UUID: "05f061bd-02a3-11ee-857c-aa370ff6666b",
244243
Seqno: 1,
245-
GTID: &GTID{DomainID: 0, ServerID: 1, SequenceNumber: 2},
246244
SafeToBootstrap: true,
247245
},
248246
},

0 commit comments

Comments
 (0)