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

pdutil: use temp pause config #592

Merged
merged 25 commits into from
Nov 16, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
3pointer marked this conversation as resolved.
Show resolved Hide resolved
version = pauseConfigVersion
kennytm marked this conversation as resolved.
Show resolved Hide resolved
}
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