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

Commit

Permalink
add pd version fail back
Browse files Browse the repository at this point in the history
  • Loading branch information
3pointer committed Nov 10, 2020
1 parent 7cf0c64 commit 24f2d24
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/pdutil/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ const (
)

var (
// in this version we can use pause configs
// in v4.0.8 version we can use pause configs
// see https://github.com/tikv/pd/pull/3088
pauseConfigVersion = semver.New("4.0.8")
pauseConfigVersion = semver.New("4.0.7")
)

// clusterConfig represents a set of scheduler whose config have been modified
Expand Down Expand Up @@ -170,7 +170,12 @@ func NewPdController(
return nil, errors.Annotatef(berrors.ErrPDUpdateFailed, "pd address (%s) not available, please check network", pdAddrs)
}

version := semver.New(string(versionBytes))
version, err := semver.NewVersion(string(versionBytes))
if err != nil {
log.Warn("fail back to old version",
zap.Binary("version", versionBytes), zap.Error(err))
version = pauseConfigVersion
}
maxCallMsgSize := []grpc.DialOption{
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxMsgSize)),
grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(maxMsgSize)),
Expand All @@ -197,7 +202,7 @@ func NewPdController(
}

func (p *PdController) isPauseConfigEnabled() bool {
return p.version.Compare(*pauseConfigVersion) >= 0
return p.version.Compare(*pauseConfigVersion) > 0
}

// SetHTTP set pd addrs and cli for test.
Expand Down

0 comments on commit 24f2d24

Please sign in to comment.