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

ha: remove unused etcd task cfg key (#2180) #2193

Merged
Merged
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
5 changes: 1 addition & 4 deletions dm/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ var (
// UpstreamRelayWorkerKeyAdapter is used to store the upstream which this worker needs to pull relay log
// k/v: Encode(worker-name) -> source-id.
UpstreamRelayWorkerKeyAdapter KeyAdapter = keyHexEncoderDecoder("/dm-master/relay-worker/")
// TaskConfigKeyAdapter is used to store task config string.
// k/v: Encode(task-name) -> task-config-string.
TaskConfigKeyAdapter KeyAdapter = keyHexEncoderDecoder("/dm-master/task/")
// UpstreamSubTaskKeyAdapter is used to store SubTask which are subscribing data from MySQL source.
// k/v: Encode(source-id, task-name) -> SubTaskConfig.
UpstreamSubTaskKeyAdapter KeyAdapter = keyHexEncoderDecoder("/dm-master/upstream/subtask/")
Expand Down Expand Up @@ -96,7 +93,7 @@ var (
func keyAdapterKeysLen(s KeyAdapter) int {
switch s {
case WorkerRegisterKeyAdapter, UpstreamConfigKeyAdapter, UpstreamBoundWorkerKeyAdapter,
WorkerKeepAliveKeyAdapter, StageRelayKeyAdapter, TaskConfigKeyAdapter,
WorkerKeepAliveKeyAdapter, StageRelayKeyAdapter,
UpstreamLastBoundWorkerKeyAdapter, UpstreamRelayWorkerKeyAdapter:
return 1
case UpstreamSubTaskKeyAdapter, StageSubTaskKeyAdapter,
Expand Down
3 changes: 1 addition & 2 deletions pkg/ha/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func sourceCfgFromResp(source string, resp *clientv3.GetResponse) (map[string]*c
// this function shouldn't be used in development environment.
func ClearTestInfoOperation(cli *clientv3.Client) error {
clearSource := clientv3.OpDelete(common.UpstreamConfigKeyAdapter.Path(), clientv3.WithPrefix())
clearTask := clientv3.OpDelete(common.TaskConfigKeyAdapter.Path(), clientv3.WithPrefix())
clearSubTask := clientv3.OpDelete(common.UpstreamSubTaskKeyAdapter.Path(), clientv3.WithPrefix())
clearWorkerInfo := clientv3.OpDelete(common.WorkerRegisterKeyAdapter.Path(), clientv3.WithPrefix())
clearWorkerKeepAlive := clientv3.OpDelete(common.WorkerKeepAliveKeyAdapter.Path(), clientv3.WithPrefix())
Expand All @@ -136,7 +135,7 @@ func ClearTestInfoOperation(cli *clientv3.Client) error {
clearRelayConfig := clientv3.OpDelete(common.UpstreamRelayWorkerKeyAdapter.Path(), clientv3.WithPrefix())
clearSubTaskStage := clientv3.OpDelete(common.StageSubTaskKeyAdapter.Path(), clientv3.WithPrefix())
clearLoadTasks := clientv3.OpDelete(common.LoadTaskKeyAdapter.Path(), clientv3.WithPrefix())
_, _, err := etcdutil.DoOpsInOneTxnWithRetry(cli, clearSource, clearTask, clearSubTask, clearWorkerInfo, clearBound,
_, _, err := etcdutil.DoOpsInOneTxnWithRetry(cli, clearSource, clearSubTask, clearWorkerInfo, clearBound,
clearLastBound, clearWorkerKeepAlive, clearRelayStage, clearRelayConfig, clearSubTaskStage, clearLoadTasks)
return err
}