Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
okJiang committed Mar 14, 2024
1 parent 494cb56 commit 0238e11
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions mysql/mariadb_gtid.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ func (s *MariadbGTIDSet) Clone() GTIDSet {
Sets: make(map[uint32]map[uint32]*MariadbGTID),
}
for domainID, set := range s.Sets {
clone.Sets[domainID] = make(map[uint32]*MariadbGTID)
for serverID, gtid := range set {
if clone.Sets[domainID] == nil {
clone.Sets[domainID] = make(map[uint32]*MariadbGTID)
}
clone.Sets[domainID][serverID] = gtid.Clone()
}
}
Expand All @@ -215,18 +213,14 @@ func (s *MariadbGTIDSet) Equal(o GTIDSet) bool {
}

for domainID, set := range other.Sets {
serverSet, ok := s.Sets[domainID]
if !ok {
return false
}
for serverID, gtid := range set {
serverSet, ok := s.Sets[domainID]
if !ok {
return false
}

o, ok := serverSet[serverID]
if !ok {
if o, ok := serverSet[serverID]; !ok {
return false
}

if *gtid != *o {
} else if *gtid != *o {
return false
}
}
Expand All @@ -243,12 +237,11 @@ func (s *MariadbGTIDSet) Contain(o GTIDSet) bool {
}

for doaminID, set := range other.Sets {
serverSet, ok := s.Sets[doaminID]
if !ok {
return false
}
for serverID, gtid := range set {
serverSet, ok := s.Sets[doaminID]
if !ok {
return false
}

if o, ok := serverSet[serverID]; !ok {
return false
} else if !o.Contain(gtid) {
Expand Down

0 comments on commit 0238e11

Please sign in to comment.