This repository has been archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 188
master: use etcd as operate queue #363
Closed
Closed
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
47b099a
add command proto and master write some request to etcd, and watch re…
WangXiangUSTC b26d68e
update some request
WangXiangUSTC 6c5c75a
update name
WangXiangUSTC 0143e5f
minor update
WangXiangUSTC 889e7a9
Merge branch 'master' into xiang/etcd_operate_queue
WangXiangUSTC 6709763
use etcd in tidb-tools
WangXiangUSTC f85e98c
fix test
WangXiangUSTC a946031
fix unit test
WangXiangUSTC 62afe6e
add some error
WangXiangUSTC d7298f5
minor update
WangXiangUSTC 0b0d372
fix
WangXiangUSTC 6b869ef
add Unknown operate type
WangXiangUSTC 9891c9a
address comment
WangXiangUSTC 83bc4cb
update function saveRequestAndWaitResponse
WangXiangUSTC b640925
update function name
WangXiangUSTC 92e8265
address comment
WangXiangUSTC c04fcee
delete useless import
WangXiangUSTC 9899502
address comment
WangXiangUSTC 4c09e2e
Merge branch 'master' into xiang/etcd_operate_queue
csuzhangxc c6cc5ca
address comment
WangXiangUSTC eab5c48
address comment
WangXiangUSTC 88a551e
merge master and resolve conflicts
WangXiangUSTC a27edd8
only leader handle request
WangXiangUSTC 314f5e3
fix unit test
WangXiangUSTC 0ddd1dd
add log
WangXiangUSTC ccd1a79
Merge branch 'master' into xiang/etcd_operate_queue
WangXiangUSTC 1a82e68
add ShowMasterLeader rpc server, and update check master online
WangXiangUSTC 26abd88
add operate stage
WangXiangUSTC a7759dc
merge master
WangXiangUSTC 2e67069
add some log
WangXiangUSTC 3fd9af5
minor fix
WangXiangUSTC 5f75338
add show master leader test
WangXiangUSTC 39a1fbc
fix ci
WangXiangUSTC b8518cd
Merge branch 'master' into xiang/etcd_operate_queue
IANTHEREAL f0931fb
update log
WangXiangUSTC 0201e85
add comment for unit test
WangXiangUSTC 20524e7
update proto and other update
WangXiangUSTC 7d89605
Merge branch 'xiang/etcd_operate_queue' of https://github.com/pingcap…
WangXiangUSTC b091a46
add log for watch request
WangXiangUSTC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2019 PingCAP, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package master | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/pingcap/errors" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/pingcap/dm/dm/ctl/common" | ||
"github.com/pingcap/dm/dm/pb" | ||
) | ||
|
||
// NewShowLeaderCmd creates a ShowMasterLeader command | ||
func NewShowLeaderCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "show-master-leader", | ||
Short: "show the DM-master's leader information", | ||
Run: showLeaderFunc, | ||
} | ||
return cmd | ||
} | ||
|
||
// showLeaderFunc does show master leader request | ||
func showLeaderFunc(cmd *cobra.Command, _ []string) { | ||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
// show master leader | ||
cli := common.MasterClient() | ||
resp, err := cli.ShowMasterLeader(ctx, &pb.ShowMasterLeaderRequest{}) | ||
if err != nil { | ||
common.PrintLines("fail to show master leader:\n%v", errors.ErrorStack(err)) | ||
return | ||
} | ||
|
||
common.PrettyPrintResponse(resp) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
I also defined this in pkg/etcdutil/etcdutil.go. and and a
CreateClient
in it in #367 . we can merge then 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, if your pr merged first I will use your function.
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.
@WangXiangUSTC It's time to update this
defaultEtcdTimeout
with the one in pkg/etcdutil/etcdutil.go now?