-
Notifications
You must be signed in to change notification settings - Fork 188
operate-schema: flush schema info and sync to master in optimistic mode #1506
Conversation
syncer/checkpoint.go
Outdated
args = append(args, arg) | ||
|
||
// use a new context apart from syncer, to make sure when syncer call `cancel` checkpoint could update | ||
tctx2, cancel := tctx.WithContext(context.Background()).WithTimeout(maxDMLConnectionDuration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suddently realized if this action cost a long time, other checkpoint method maybe blocked. Hope it will not block upward to some user interface commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since operate-schema can only use when task paused, the impact of other checkpoint method should be minimal. For user interface, maybe we can use smaller timeout arg?
Co-authored-by: lance6716 <lance6716@gmail.com>
Co-authored-by: lance6716 <lance6716@gmail.com>
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
dm/master/shardddl/optimist.go
Outdated
@@ -499,7 +499,9 @@ func (o *Optimist) handleOperationPut(ctx context.Context, opCh <-chan optimism. | |||
func (o *Optimist) handleLock(info optimism.Info, tts []optimism.TargetTable, skipDone bool) error { | |||
lockID, newDDLs, err := o.lk.TrySync(info, tts) | |||
var cfStage = optimism.ConflictNone | |||
if err != nil { | |||
if info.IgnoreConflict { | |||
o.logger.Warn("handle lock in ignore conflict mode", zap.String("lock", lockID), zap.Stringer("info", info)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we are in ignore-conflict
mode, I think it's better to log the error rather than omit it.
pkg/shardddl/optimism/lock_test.go
Outdated
info = NewInfo(task, source, db, tbls[0], downSchema, downTable, DDLs1, nil, []*model.TableInfo{ti1}) | ||
info.Version = vers[source][db][tbls[0]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add a function NewInfoWithVersion
in this test.go
since it's used so many times.
syncer/checkpoint.go
Outdated
@@ -553,6 +557,43 @@ func (cp *RemoteCheckPoint) FlushPointsExcept(tctx *tcontext.Context, exceptTabl | |||
return nil | |||
} | |||
|
|||
// FlushPointWithTableInfo implements CheckPoint.FlushPointWithTableInfo | |||
func (cp *RemoteCheckPoint) FlushPointWithTableInfo(tctx *tcontext.Context, schema string, table string, ti *model.TableInfo) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right?
func (cp *RemoteCheckPoint) FlushPointWithTableInfo(tctx *tcontext.Context, schema string, table string, ti *model.TableInfo) error { | |
func (cp *RemoteCheckPoint) FlushPointWithTableInfo(tctx *tcontext.Context, sourceSchema, sourceTable string, ti *model.TableInfo) error { |
Co-authored-by: Chunzhu Li <lichunzhu@stu.xjtu.edu.cn>
Co-authored-by: Chunzhu Li <lichunzhu@stu.xjtu.edu.cn>
Co-authored-by: Chunzhu Li <lichunzhu@stu.xjtu.edu.cn>
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-2.0 in PR #1514 |
What problem does this PR solve?
handle rename column statement
What is changed and how it works?
--flush
and--sync
foroperate-schema set
Check List
Tests
Code changes