Skip to content

Commit

Permalink
cherry pick #2916 to release-4.0
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed Sep 7, 2020
1 parent a1d3230 commit 5becb79
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cmd/pd-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func main() {

err = join.PrepareJoinCluster(cfg)
if err != nil {
log.Fatal("join meet error", zap.Error(err))
log.Fatal("join meet error", errs.ZapError(err))
}

// Creates server.
Expand All @@ -117,7 +117,7 @@ func main() {
}()

if err := svr.Run(); err != nil {
log.Fatal("run server failed", zap.Error(err))
log.Fatal("run server failed", errs.ZapError(err))
}

<-ctx.Done()
Expand Down
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ func CheckHealth(client *http.Client, members []*pdpb.Member) map[uint64]*pdpb.M
ctx, cancel := context.WithTimeout(context.Background(), clientTimeout)
req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("%s%s", cURL, healthURL), nil)
if err != nil {
log.Error("failed to new request", zap.Error(err))
log.Error("failed to new request", errs.ZapError(errs.ErrNewHTTPRequest, err))
cancel()
continue
}
Expand Down
2 changes: 1 addition & 1 deletion server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
// used to load region from kv storage to cache storage.
err := s.server.GetStorage().LoadRegionsOnce(s.server.GetBasicCluster().CheckAndPutRegion)
if err != nil {
log.Warn("failed to load regions.", zap.Error(err))
log.Warn("failed to load regions.", errs.ZapError(err))
}
// establish client.
var conn *grpc.ClientConn
Expand Down
3 changes: 2 additions & 1 deletion server/schedule/checker/replica_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/schedule/filter"
"github.com/tikv/pd/server/schedule/operator"
Expand Down Expand Up @@ -91,7 +92,7 @@ func (r *ReplicaChecker) Check(region *core.RegionInfo) *operator.Operator {
checkerCounter.WithLabelValues("replica_checker", "new-operator").Inc()
op, err := operator.CreateAddPeerOperator("make-up-replica", r.cluster, region, newPeer, operator.OpReplica)
if err != nil {
log.Debug("create make-up-replica operator fail", zap.Error(err))
log.Debug("create make-up-replica operator fail", errs.ZapError(err))
return nil
}
return op
Expand Down
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ func (s *Server) campaignLeader() {
// Try to create raft cluster.
err = s.createRaftCluster()
if err != nil {
log.Error("failed to create raft cluster", zap.Error(err))
log.Error("failed to create raft cluster", errs.ZapError(err))
return
}
defer s.stopRaftCluster()
Expand Down Expand Up @@ -1175,7 +1175,7 @@ func (s *Server) campaignLeader() {
}
case <-tsTicker.C:
if err = s.tso.UpdateTimestamp(); err != nil {
log.Error("failed to update timestamp", zap.Error(err))
log.Error("failed to update timestamp", errs.ZapError(err))
return
}
case <-ctx.Done():
Expand Down
2 changes: 1 addition & 1 deletion server/tso/tso.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (t *TimestampOracle) GetRespTS(count uint32) (pdpb.Timestamp, error) {
if resp.Logical >= maxLogical {
log.Error("logical part outside of max logical interval, please check ntp time",
zap.Reflect("response", resp),
zap.Int("retry-count", i))
zap.Int("retry-count", i), errs.ZapError(errs.ErrLogicOverflow))
tsoCounter.WithLabelValues("logical_overflow").Inc()
time.Sleep(UpdateTimestampStep)
continue
Expand Down

0 comments on commit 5becb79

Please sign in to comment.