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) #9948

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 @@ -351,9 +351,24 @@
// 0, true if gSet1 is equal to gSet2
// -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 354 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 354 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 358 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 358 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) {

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

View workflow job for this annotation

GitHub Actions / Mac OS Build

CompareGTID redeclared in this block

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

View workflow job for this annotation

GitHub Actions / Arm Build (ARM64)

CompareGTID redeclared in this block
gSetIsEmpty1 := CheckGTIDSetEmpty(gSet1)
gSetIsEmpty2 := CheckGTIDSetEmpty(gSet2)
>>>>>>> 5ec0b15ee1 (Removed String() call in favor of variable substitution. (#9829))

Check failure on line 371 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 371 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 371 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 371 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 371 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 371 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
6 changes: 6 additions & 0 deletions dm/syncer/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,13 @@ func (cp *RemoteCheckPoint) IsOlderThanTablePoint(table *filter.Table, location
return false
}
oldLocation := point.MySQLLocation()
<<<<<<< HEAD
cp.logCtx.L().Debug("compare table location whether is newer", zap.Stringer("location", location), zap.Stringer("old location", oldLocation))
=======
// 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 && !(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))
>>>>>>> 5ec0b15ee1 (Removed String() call in favor of variable substitution. (#9829))

if useLE {
return binlog.CompareLocation(location, oldLocation, cp.cfg.EnableGTID) <= 0
Expand Down
5 changes: 5 additions & 0 deletions dm/syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3648,7 +3648,12 @@ func (s *Syncer) adjustGlobalPointGTID(tctx *tcontext.Context) (bool, error) {
// 1. GTID is not enabled
// 2. location already has GTID position
// 3. location is totally new, has no position info
<<<<<<< HEAD
if !s.cfg.EnableGTID || location.GTIDSetStr() != "" || location.Position.Name == "" {
=======
// 4. location is too early thus not a COMMIT location, which happens when it's reset by other logic
if !s.cfg.EnableGTID || !binlog.CheckGTIDSetEmpty(location.GetGTID()) || location.Position.Name == "" || location.Position.Pos == 4 {
>>>>>>> 5ec0b15ee1 (Removed String() call in favor of variable substitution. (#9829))
return false, nil
}
// set enableGTID to false for new streamerController
Expand Down
Loading