etcdserver/api/capability.go
func UpdateCapability(lg *zap.Logger, v *semver.Version) {
	if v == nil {
		// if recovered but version was never set by cluster
		return
	}
	enableMapMu.Lock()
	if curVersion != nil && !curVersion.LessThan(*v) {
		enableMapMu.Unlock()
		return
	}
	curVersion = v
	enabledMap = capabilityMaps[curVersion.String()]
	enableMapMu.Unlock()

	if lg != nil {
		lg.Info(
			"enabled capabilities for version",
			zap.String("cluster-version", version.Cluster(v.String())),
		)
	} else {
		plog.Infof("enabled capabilities for version %s", version.Cluster(v.String()))
	}
}
func UpdateCapability(lg *zap.Logger, v *semver.Version) {
	if v == nil {
		// if recovered but version was never set by cluster
		return
	}
	enableMapMu.Lock()
	if curVersion != nil && !curVersion.LessThan(*v) {
		enableMapMu.Unlock()
		return
	}
	curVersion = v
	enabledMap = capabilityMaps[curVersion.String()]
	enableMapMu.Unlock()

	if lg != nil {
		lg.Info(
			"enabled capabilities for version",
			zap.String("cluster-version", version.Cluster(v.String())),
		)
	} else {
		plog.Infof("enabled capabilities for version %s", version.Cluster(v.String()))
	}
}
// UpdateCapability updates the enabledMap when the cluster version increases.