diff --git a/pkg/galera/galera.go b/pkg/galera/galera.go index b14507d..f0ff8cb 100644 --- a/pkg/galera/galera.go +++ b/pkg/galera/galera.go @@ -36,7 +36,6 @@ type GaleraState struct { Version string `json:"version"` UUID string `json:"uuid"` Seqno int `json:"seqno"` - GTID *GTID `json:"gtid"` SafeToBootstrap bool `json:"safeToBootstrap"` } @@ -74,14 +73,13 @@ func (g *GaleraState) MarshalText() ([]byte, error) { } tpl := createTpl("grastate.dat", `version: {{ .Version }} uuid: {{ .UUID }} -seqno: {{ .Seqno }}{{ if .GTID }},{{ .GTID }}{{ end }} +seqno: {{ .Seqno }} safe_to_bootstrap: {{ .SafeToBootstrap }}`) buf := new(bytes.Buffer) err := tpl.Execute(buf, tplOpts{ Version: g.Version, UUID: g.UUID, Seqno: g.Seqno, - GTID: g.GTID, SafeToBootstrap: func() int { if g.SafeToBootstrap { return 1 @@ -125,7 +123,10 @@ func (g *GaleraState) UnmarshalText(text []byte) error { uuid = &value case "seqno": // When the `wsrep_gtid_mode` is set to `ON`, the `seqno` is - // actually a string of the form `seqno,gtid`. + // actually a string of the form `,`. + // + // For the moment we only care about the `seqno` part as we're + // still not sure about what to do with the `gtid`. seqnoStr, gtidStr, found := strings.Cut(value, ",") if found { gtid = >ID{} @@ -133,7 +134,6 @@ func (g *GaleraState) UnmarshalText(text []byte) error { if err != nil { return fmt.Errorf("error parsing gtid: %v", err) } - } i, err := strconv.Atoi(seqnoStr) if err != nil { @@ -158,10 +158,6 @@ func (g *GaleraState) UnmarshalText(text []byte) error { g.Version = *version g.UUID = *uuid g.Seqno = *seqno - // Only set the GTID if it was found in the file. - if gtid != nil { - g.GTID = gtid - } g.SafeToBootstrap = *safeToBootstrap return nil } diff --git a/pkg/galera/galera_test.go b/pkg/galera/galera_test.go index e3c7011..d67c213 100644 --- a/pkg/galera/galera_test.go +++ b/pkg/galera/galera_test.go @@ -71,12 +71,11 @@ safe_to_bootstrap: 0`, Version: "2.1", UUID: "05f061bd-02a3-11ee-857c-aa370ff6666b", Seqno: 1, - GTID: >ID{DomainID: 0, ServerID: 1, SequenceNumber: 2}, SafeToBootstrap: true, }, want: `version: 2.1 uuid: 05f061bd-02a3-11ee-857c-aa370ff6666b -seqno: 1,0-1-2 +seqno: 1 safe_to_bootstrap: 1`, wantErr: false, }, @@ -242,7 +241,6 @@ safe_to_bootstrap: 1`), Version: "2.1", UUID: "05f061bd-02a3-11ee-857c-aa370ff6666b", Seqno: 1, - GTID: >ID{DomainID: 0, ServerID: 1, SequenceNumber: 2}, SafeToBootstrap: true, }, },