Skip to content

Commit

Permalink
refine binlogctl's output (#149) (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
WangXiangUSTC authored Jan 25, 2019
1 parent 3737b5f commit 170311c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tidb-binlog/binlogctl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewConfig() *Config {
cfg.FlagSet = flag.NewFlagSet("binlogctl", flag.ContinueOnError)

cfg.FlagSet.StringVar(&cfg.Command, "cmd", "pumps", "operator: \"generate_meta\", \"pumps\", \"drainers\", \"update-pump\", \"update-drainer\", \"pause-pump\", \"pause-drainer\", \"offline-pump\", \"offline-drainer\"")
cfg.FlagSet.StringVar(&cfg.NodeID, "node-id", "", "id of node, use to delete some node with operation delete-pump and delete-drainer")
cfg.FlagSet.StringVar(&cfg.NodeID, "node-id", "", "id of node, use to update some node with operation update-pump, update-drainer, pause-pump, pause-drainer, offline-pump and offline-drainer")
cfg.FlagSet.StringVar(&cfg.DataDir, "data-dir", defaultDataDir, "meta directory path")
cfg.FlagSet.StringVar(&cfg.EtcdURLs, "pd-urls", defaultEtcdURLs, "a comma separated list of PD endpoints")
cfg.FlagSet.StringVar(&cfg.SSLCA, "ssl-ca", "", "Path of file that contains list of trusted SSL CAs for connection with cluster components.")
Expand Down
7 changes: 6 additions & 1 deletion tidb-binlog/binlogctl/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func queryNodesByKind(urls string, kind string) error {
}

for _, n := range nodes {
log.Infof("%s: %+v", kind, n)
log.Infof("%s: %s", kind, formatNodeInfo(n))
}

return nil
Expand Down Expand Up @@ -129,3 +129,8 @@ func applyAction(urls, kind, nodeID string, action string) error {

return errors.NotFoundf("nodeID %s", nodeID)
}

func formatNodeInfo(status *node.Status) string {
updateTime := utils.TSOToRoughTime(status.UpdateTS)
return fmt.Sprintf("{NodeID: %s, Addr: %s, State: %s, MaxCommitTS: %d, UpdateTime: %v}", status.NodeID, status.Addr, status.State, status.MaxCommitTS, updateTime)
}

0 comments on commit 170311c

Please sign in to comment.