-
Notifications
You must be signed in to change notification settings - Fork 188
HA: refactor unlock-ddl-lock and break-ddl-lock #522
Conversation
/run-all-tests tidb=release-3.0 |
/run-all-tests tidb=release-3.0 |
/run-all-tests tidb=release-3.0 |
Codecov Report
@@ Coverage Diff @@
## master #522 +/- ##
==========================================
Coverage ? 56.846%
==========================================
Files ? 183
Lines ? 18821
Branches ? 0
==========================================
Hits ? 10699
Misses ? 7046
Partials ? 1076 |
/run-all-tests tidb=release-3.0 |
/run-all-tests tidb=release-3.0 |
@lichunzhu @WangXiangUSTC PTAL |
Co-Authored-By: Chunzhu Li <lichunzhu@pingcap.com>
/run-all-tests tidb=release-3.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.
In some other places:
https://github.com/pingcap/dm/blob/master/pkg/shardddl/pessimism/operation_test.go#L68
https://github.com/pingcap/dm/blob/master/pkg/shardddl/pessimism/operation_test.go#L84
https://github.com/pingcap/dm/blob/master/syncer/shardddl/pessimist.go#L86
We are still using rev
instead of rev+1
. Should we unify them?
Rest LGTM
/run-all-tests tidb=release-3.0 |
for
for
I updated in the caller (syncer.go) in 1ddb439. |
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.
LGTM
/run-all-tests tidb=release-3.0 |
|
||
for _, source := range sources { | ||
if synced, ok := l.ready[source]; ok && synced { | ||
l.ready[source] = false |
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.
do we need to revert l.done[source]
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.
The only usage of RevertSynced
is to revert Synced
for ForceSynced
.
and currenly we can't RevertSynced
is the owner done the exec operation (done
happened after that).
/run-all-tests tidb=release-3.0 |
// UnlockLock unlocks a shard DDL lock manually when using `unlock-ddl-lock` command. | ||
// ID: the shard DDL lock ID. | ||
// replaceOwner: the new owner used to replace the original DDL for executing DDL to downstream. | ||
// if the original owner is still exist, we should NOT specify any replaceOwner. |
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.
in which case the original owner is not existing?
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.
and maybe we should choose a replaceOwner
automatic later.
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.
in which case the original owner is not existing
operate-source stop
takes on the original owner.
and maybe we should choose a replaceOwner automatic later.
YES, it's better to do that automatically.
/run-all-tests tidb=release-3.0 |
@@ -61,6 +62,11 @@ func (s *Server) electionNotify(ctx context.Context) { | |||
log.L().Error("scheduler do not started", zap.Error(err)) | |||
} | |||
|
|||
err = s.pessimist.Start(ctx, s.etcdClient) | |||
if err != nil { | |||
log.L().Error("pessimist do not started", zap.Error(err)) |
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.
if start pessimist failed, do we need close scheduler and skip set leader in L71?
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 think we need a mechanism to transfer leader role to another DM-master member when any necessary components (pessimist and scheduler in currenlty) started fail later.
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.
and close the pessimist
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 think we need a mechanism to transfer leader role to another DM-master member when any necessary components (pessimist and scheduler in currenlty) started fail later.
ok, we can do this later
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.
@lichunzhu you can open a issue to trace leader transfer support
later.
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.
OK
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
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.
LGTM
What problem does this PR solve?
refactor
unlock-ddl-lock
andbreak-ddl-lock
to support HA.What is changed and how it works?
unlock-ddl-lock
based on the etcd model.break-ddl-lock
because it's not needed anymore in the new model.Check List
Tests
Code changes
Side effects