Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
add location clone
Browse files Browse the repository at this point in the history
  • Loading branch information
WangXiangUSTC committed Mar 9, 2020
1 parent c63832e commit 53bef75
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions syncer/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ func (cp *RemoteCheckPoint) Load(tctx *tcontext.Context, schemaTracker *schema.T
}
if isGlobal {
if binlog.CompareLocation(location, binlog.NewLocation(cp.cfg.Flavor)) > 0 {
cp.globalPoint = newBinlogPoint(location, location, nil, nil)
cp.globalPoint = newBinlogPoint(location.Clone(), location.Clone(), nil, nil)
cp.logCtx.L().Info("fetch global checkpoint from DB", log.WrapStringerField("global checkpoint", cp.globalPoint))
}
continue // skip global checkpoint
Expand All @@ -659,7 +659,7 @@ func (cp *RemoteCheckPoint) Load(tctx *tcontext.Context, schemaTracker *schema.T
mSchema = make(map[string]*binlogPoint)
cp.points[cpSchema] = mSchema
}
mSchema[cpTable] = newBinlogPoint(location, location, &ti, &ti)
mSchema[cpTable] = newBinlogPoint(location.Clone(), location.Clone(), &ti, &ti)
}

return terror.WithScope(terror.DBErrorAdapt(rows.Err(), terror.ErrDBDriverError), terror.ScopeDownstream)
Expand All @@ -683,8 +683,7 @@ func (cp *RemoteCheckPoint) LoadMeta() error {
// load meta from task config
if cp.cfg.Meta == nil {
cp.logCtx.L().Warn("don't set meta in increment task-mode")
location1 := binlog.NewLocation(cp.cfg.Flavor)
cp.globalPoint = newBinlogPoint(location1, location1, nil, nil)
cp.globalPoint = newBinlogPoint(binlog.NewLocation(cp.cfg.Flavor), binlog.NewLocation(cp.cfg.Flavor), nil, nil)
return nil
}
gset, err := gtid.ParserGTID(cp.cfg.Flavor, cp.cfg.Meta.BinLogGTID)
Expand All @@ -706,7 +705,7 @@ func (cp *RemoteCheckPoint) LoadMeta() error {

// if meta loaded, we will start syncing from meta's pos
if location != nil {
cp.globalPoint = newBinlogPoint(*location, *location, nil, nil)
cp.globalPoint = newBinlogPoint(location.Clone(), location.Clone(), nil, nil)
cp.logCtx.L().Info("loaded checkpoints from meta", log.WrapStringerField("global checkpoint", cp.globalPoint))
}

Expand Down

0 comments on commit 53bef75

Please sign in to comment.