diff --git a/go.mod b/go.mod index eff25302e685..6d0673f005dd 100644 --- a/go.mod +++ b/go.mod @@ -29,8 +29,8 @@ require ( github.com/pingcap/check v0.0.0-20191216031241-8a5a85928f12 github.com/pingcap/errcode v0.0.0-20180921232412-a1a7271709d9 github.com/pingcap/failpoint v0.0.0-20191029060244-12f4ac2fd11d - github.com/pingcap/kvproto v0.0.0-20200518112156-d4aeb467de29 - github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd + github.com/pingcap/kvproto v0.0.0-20200616092848-8037ca08f377 + github.com/pingcap/log v0.0.0-20200511115504-543df19646ad github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.0.0 diff --git a/go.sum b/go.sum index 890258933fc9..2744ab45ad0c 100644 --- a/go.sum +++ b/go.sum @@ -292,12 +292,14 @@ github.com/pingcap/failpoint v0.0.0-20191029060244-12f4ac2fd11d h1:F8vp38kTAckN+ github.com/pingcap/failpoint v0.0.0-20191029060244-12f4ac2fd11d/go.mod h1:DNS3Qg7bEDhU6EXNHF+XSv/PGznQaMJ5FWvctpm6pQI= github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO7l8IOcQG+t+ItJ3fEcrL5FxF0Wu+HrMy26w= github.com/pingcap/kvproto v0.0.0-20200411081810-b85805c9476c/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= -github.com/pingcap/kvproto v0.0.0-20200518112156-d4aeb467de29 h1:NpW1OuYrIl+IQrSsVbtyHpHpazmSCHy+ysrOixY0xY4= -github.com/pingcap/kvproto v0.0.0-20200518112156-d4aeb467de29/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/kvproto v0.0.0-20200616092848-8037ca08f377 h1:KUUCELlkPNwYXdTu9kCcf1kMSFqz6I6i9F0nXfPO2vs= +github.com/pingcap/kvproto v0.0.0-20200616092848-8037ca08f377/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 h1:AJD9pZYm72vMgPcQDww9rkZ1DnWfl0pXV3BOWlkYIjA= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd h1:CV3VsP3Z02MVtdpTMfEgRJ4T9NGgGTxdHpJerent7rM= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/log v0.0.0-20200511115504-543df19646ad h1:SveG82rmu/GFxYanffxsSF503SiQV+2JLnWEiGiF+Tc= +github.com/pingcap/log v0.0.0-20200511115504-543df19646ad/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/sysutil v0.0.0-20200206130906-2bfa6dc40bcd/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI= github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1 h1:PI8YpTl45F8ilNkrPtT4IdbcZB1SCEa+gK/U5GJYl3E= github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI= diff --git a/server/cluster/cluster.go b/server/cluster/cluster.go index bd09813f01ea..35853859da73 100644 --- a/server/cluster/cluster.go +++ b/server/cluster/cluster.go @@ -1720,6 +1720,11 @@ func (c *RaftCluster) SetAllStoresLimit(typ storelimit.Type, ratePerMin float64) c.opt.SetAllStoresLimit(typ, ratePerMin) } +// GetClusterVersion returns the current cluster version. +func (c *RaftCluster) GetClusterVersion() string { + return c.opt.GetClusterVersion().String() +} + var healthURL = "/pd/api/v1/ping" // CheckHealth checks if members are healthy. diff --git a/server/grpc_service.go b/server/grpc_service.go index 1914c25de60e..c8627ae1a80f 100644 --- a/server/grpc_service.go +++ b/server/grpc_service.go @@ -307,6 +307,7 @@ func (s *Server) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHeartbea return &pdpb.StoreHeartbeatResponse{ Header: s.header(), ReplicationStatus: rc.GetReplicationMode().GetReplicationStatus(), + ClusterVersion: rc.GetClusterVersion(), }, nil }