Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <[email protected]>
  • Loading branch information
nolouch committed Feb 19, 2019
1 parent cb88fd6 commit a180ff5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions server/cluster_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func (c *clusterInfo) handleRegionHeartbeat(region *core.RegionInfo) error {
// Mark isNew if the region in cache does not have leader.
var saveKV, saveCache, isNew bool
if origin == nil {
log.Debug("Insert new region",
log.Debug("insert new region",
zap.Uint64("region-id", region.GetID()),
zap.Reflect("meta-region", core.HexRegionMeta(region.GetMeta())),
)
Expand All @@ -504,7 +504,7 @@ func (c *clusterInfo) handleRegionHeartbeat(region *core.RegionInfo) error {
return ErrRegionIsStale(region.GetMeta(), origin.GetMeta())
}
if r.GetVersion() > o.GetVersion() {
log.Info("Region Version Changed",
log.Info("region Version changed",
zap.Uint64("region-id", region.GetID()),
zap.String("detail", core.DiffRegionKeyInfo(origin, region)),
zap.Uint64("old-version", o.GetVersion()),
Expand All @@ -513,7 +513,7 @@ func (c *clusterInfo) handleRegionHeartbeat(region *core.RegionInfo) error {
saveKV, saveCache = true, true
}
if r.GetConfVer() > o.GetConfVer() {
log.Info("Region ConfVer Changed",
log.Info("region ConfVer changed",
zap.Uint64("region-id", region.GetID()),
zap.String("detail", core.DiffRegionPeersInfo(origin, region)),
zap.Uint64("old-confver", o.GetConfVer()),
Expand All @@ -525,7 +525,7 @@ func (c *clusterInfo) handleRegionHeartbeat(region *core.RegionInfo) error {
if origin.GetLeader().GetId() == 0 {
isNew = true
} else {
log.Info("Leader Changed",
log.Info("leader changed",
zap.Uint64("region-id", region.GetID()),
zap.Uint64("from", origin.GetLeader().GetStoreId()),
zap.Uint64("to", region.GetLeader().GetStoreId()),
Expand Down Expand Up @@ -581,7 +581,7 @@ func (c *clusterInfo) handleRegionHeartbeat(region *core.RegionInfo) error {
if err := c.kv.DeleteRegion(item); err != nil {
log.Error("fail to delete region from kv",
zap.Uint64("region-id", item.GetId()),
zap.Stringer("region-meta", core.HexRegionMeta(item)),
zap.Reflect("region-meta", core.HexRegionMeta(item)),
zap.Error(err))
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (c *coordinator) run() {
scheduleCfg.Schedulers = scheduleCfg.Schedulers[:k]
c.cluster.opt.store(scheduleCfg)
if err := c.cluster.opt.persist(c.cluster.kv); err != nil {
log.Error("can't persist schedule config", zap.Error(err))
log.Error("cannot persist schedule config", zap.Error(err))
}

c.wg.Add(1)
Expand Down
2 changes: 1 addition & 1 deletion server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ func (s *Server) UpdateGCSafePoint(ctx context.Context, request *pdpb.UpdateGCSa
if err := s.kv.SaveGCSafePoint(newSafePoint); err != nil {
return nil, err
}
log.Info("updated gc safe point suces",
log.Info("updated gc safe point",
zap.Uint64("safe-point", newSafePoint))
} else if newSafePoint < oldSafePoint {
log.Warn("trying to update gc safe point",
Expand Down
2 changes: 1 addition & 1 deletion server/heartbeat_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func newRegionheartbeatClient(c *C, grpcClient pdpb.PDClient) *regionHeartbeatCl

func (c *regionHeartbeatClient) close() {
if err := c.stream.CloseSend(); err != nil {
log.Error("Failed to terminate client stream", zap.Error(err))
log.Error("failed to terminate client stream", zap.Error(err))
}
}

Expand Down
4 changes: 2 additions & 2 deletions server/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ func PrepareJoinCluster(cfg *Config) error {
func isDataExist(d string) bool {
dir, err := os.Open(d)
if err != nil {
log.Error("failed to open", zap.Error(err))
log.Error("failed to open directory", zap.Error(err))
return false
}
defer dir.Close()

names, err := dir.Readdirnames(-1)
if err != nil {
log.Error("failed to list", zap.Error(err))
log.Error("failed to list directory", zap.Error(err))
return false
}
return len(names) != 0
Expand Down
2 changes: 1 addition & 1 deletion server/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func (s *Server) watchLeader(leader *pdpb.Member, revision int64) {
// ResignLeader resigns current PD's leadership. If nextLeader is empty, all
// other pd-servers can campaign.
func (s *Server) ResignLeader(nextLeader string) error {
log.Info("tries to resign leader to next leader", zap.String("from", s.Name()), zap.String("to", nextLeader))
log.Info("try to resign leader to next leader", zap.String("from", s.Name()), zap.String("to", nextLeader))
// Determine next leaders.
var leaderIDs []uint64
res, err := etcdutil.ListEtcdMembers(s.client)
Expand Down

0 comments on commit a180ff5

Please sign in to comment.