Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed String() call in favor of variable substitution. (#9829) #9949

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions dm/pkg/binlog/position.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,24 @@
// -1, true if gSet1 is less than gSet2
//
// but if can't compare gSet1 and gSet2, will returns 0, false.
<<<<<<< HEAD

Check failure on line 358 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Mac OS Build

syntax error: non-declaration statement outside function body

Check failure on line 358 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Arm Build (ARM64)

syntax error: non-declaration statement outside function body
func CompareGTID(gSet1, gSet2 gtid.Set) (int, bool) {
gSetIsEmpty1 := gSet1 == nil || len(gSet1.String()) == 0
gSetIsEmpty2 := gSet2 == nil || len(gSet2.String()) == 0
=======

Check failure on line 362 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Mac OS Build

syntax error: unexpected ==, expecting }

Check failure on line 362 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Arm Build (ARM64)

syntax error: unexpected ==, expecting }
var (
emptyMySQLGTIDSet, _ = gmysql.ParseMysqlGTIDSet("")
emptyMariaDBGTIDSet, _ = gmysql.ParseMariadbGTIDSet("")
)

func CheckGTIDSetEmpty(gSet gmysql.GTIDSet) bool {
return gSet == nil || gSet.Equal(emptyMySQLGTIDSet) || gSet.Equal(emptyMariaDBGTIDSet)
}

func CompareGTID(gSet1, gSet2 gmysql.GTIDSet) (int, bool) {
gSetIsEmpty1 := CheckGTIDSetEmpty(gSet1)
gSetIsEmpty2 := CheckGTIDSetEmpty(gSet2)
>>>>>>> 5ec0b15ee1 (Removed String() call in favor of variable substitution. (#9829))

Check failure on line 375 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Mac OS Build

syntax error: unexpected >>, expecting }

Check failure on line 375 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Mac OS Build

exponent has no digits

Check failure on line 375 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Mac OS Build

invalid character U+0023 '#'

Check failure on line 375 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Arm Build (ARM64)

syntax error: unexpected >>, expecting }

Check failure on line 375 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Arm Build (ARM64)

exponent has no digits

Check failure on line 375 in dm/pkg/binlog/position.go

View workflow job for this annotation

GitHub Actions / Arm Build (ARM64)

invalid character U+0023 '#'

switch {
case gSetIsEmpty1 && gSetIsEmpty2:
Expand Down
2 changes: 1 addition & 1 deletion dm/syncer/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ func (cp *RemoteCheckPoint) IsOlderThanTablePoint(table *filter.Table, location
}
oldLocation := point.MySQLLocation()
// if we update enable-gtid = false to true, we need to compare binlog position instead of GTID before we save table point
cmpGTID := cp.cfg.EnableGTID && !(oldLocation.GTIDSetStr() == "" && binlog.ComparePosition(oldLocation.Position, binlog.MinPosition) > 0)
cmpGTID := cp.cfg.EnableGTID && !(binlog.CheckGTIDSetEmpty(oldLocation.GetGTID()) && binlog.ComparePosition(oldLocation.Position, binlog.MinPosition) > 0)
cp.logCtx.L().Debug("compare table location whether is newer", zap.Stringer("location", location), zap.Stringer("old location", oldLocation), zap.Bool("cmpGTID", cmpGTID))

return binlog.CompareLocation(location, oldLocation, cmpGTID) <= 0
Expand Down
2 changes: 1 addition & 1 deletion dm/syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4057,7 +4057,7 @@ func (s *Syncer) adjustGlobalPointGTID(tctx *tcontext.Context) (bool, error) {
// 2. location already has GTID position
// 3. location is totally new, has no position info
// 4. location is too early thus not a COMMIT location, which happens when it's reset by other logic
if !s.cfg.EnableGTID || location.GTIDSetStr() != "" || location.Position.Name == "" || location.Position.Pos == 4 {
if !s.cfg.EnableGTID || !binlog.CheckGTIDSetEmpty(location.GetGTID()) || location.Position.Name == "" || location.Position.Pos == 4 {
return false, nil
}
// set enableGTID to false for new streamerController
Expand Down
Loading