Skip to content

Commit

Permalink
Add cluster version fix etcd-io#11233 and etcd-io#11254
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjiaswe committed Oct 16, 2019
1 parent db0c8be commit 980336f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion etcdserver/membership/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ func (c *RaftCluster) SetVersion(ver *semver.Version, onSet func(*semver.Version
} else {
plog.Noticef("set the initial cluster version to %v", version.Cluster(ver.String()))
}
oldVer := c.version
c.version = ver
mustDetectDowngrade(c.version)
if c.store != nil {
Expand All @@ -377,7 +378,10 @@ func (c *RaftCluster) SetVersion(ver *semver.Version, onSet func(*semver.Version
if c.be != nil {
mustSaveClusterVersionToBackend(c.be, ver)
}
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": ver.String()}).Set(1)
if oldVer != nil {
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": version.Cluster(oldVer.String())}).Set(0)
}
ClusterVersionMetrics.With(prometheus.Labels{"cluster_version": version.Cluster(ver.String())}).Set(1)
onSet(ver)
}

Expand Down

0 comments on commit 980336f

Please sign in to comment.