@@ -36,7 +36,6 @@ type GaleraState struct {
36
36
Version string `json:"version"`
37
37
UUID string `json:"uuid"`
38
38
Seqno int `json:"seqno"`
39
- GTID * GTID `json:"gtid"`
40
39
SafeToBootstrap bool `json:"safeToBootstrap"`
41
40
}
42
41
@@ -74,14 +73,13 @@ func (g *GaleraState) MarshalText() ([]byte, error) {
74
73
}
75
74
tpl := createTpl ("grastate.dat" , `version: {{ .Version }}
76
75
uuid: {{ .UUID }}
77
- seqno: {{ .Seqno }}{{ if .GTID }},{{ .GTID }}{{ end }}
76
+ seqno: {{ .Seqno }}
78
77
safe_to_bootstrap: {{ .SafeToBootstrap }}` )
79
78
buf := new (bytes.Buffer )
80
79
err := tpl .Execute (buf , tplOpts {
81
80
Version : g .Version ,
82
81
UUID : g .UUID ,
83
82
Seqno : g .Seqno ,
84
- GTID : g .GTID ,
85
83
SafeToBootstrap : func () int {
86
84
if g .SafeToBootstrap {
87
85
return 1
@@ -125,15 +123,17 @@ func (g *GaleraState) UnmarshalText(text []byte) error {
125
123
uuid = & value
126
124
case "seqno" :
127
125
// 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`.
129
130
seqnoStr , gtidStr , found := strings .Cut (value , "," )
130
131
if found {
131
132
gtid = & GTID {}
132
133
err := gtid .UnmarshalText ([]byte (gtidStr ))
133
134
if err != nil {
134
135
return fmt .Errorf ("error parsing gtid: %v" , err )
135
136
}
136
-
137
137
}
138
138
i , err := strconv .Atoi (seqnoStr )
139
139
if err != nil {
@@ -158,10 +158,6 @@ func (g *GaleraState) UnmarshalText(text []byte) error {
158
158
g .Version = * version
159
159
g .UUID = * uuid
160
160
g .Seqno = * seqno
161
- // Only set the GTID if it was found in the file.
162
- if gtid != nil {
163
- g .GTID = gtid
164
- }
165
161
g .SafeToBootstrap = * safeToBootstrap
166
162
return nil
167
163
}
0 commit comments