mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(client): show client remote cache flag when call master client info #23062821
Signed-off-by: clinx <chenlin1@oppo.com>
This commit is contained in:
parent
c4f524a52f
commit
2de99277d2
@ -5748,15 +5748,16 @@ func (m *Server) getVolStatInfo(w http.ResponseWriter, r *http.Request) {
|
||||
hostName := r.FormValue(proto.HostKey)
|
||||
role := r.FormValue(proto.RoleKey)
|
||||
enableBcache := r.FormValue(proto.BcacheOnlyForNotSSDKey)
|
||||
log.LogInfof("getVolStatInfo: get client ver info %s, ip %s, host %s, vol %s, role %s, enableBcache %s",
|
||||
clientVer, remoteIp, hostName, name, role, enableBcache)
|
||||
enableRCache := r.FormValue(proto.EnableRemoteCache)
|
||||
log.LogInfof("getVolStatInfo: get client ver info %s, ip %s, host %s, vol %s, role %s, enableBcache %s, enableRCache %s",
|
||||
clientVer, remoteIp, hostName, name, role, enableBcache, enableRCache)
|
||||
|
||||
if vol, err = m.cluster.getVol(name); err != nil {
|
||||
sendErrReply(w, r, newErrHTTPReply(proto.ErrVolNotExists))
|
||||
return
|
||||
}
|
||||
|
||||
m.cliMgr.PutItem(remoteIp, hostName, name, clientVer, role, enableBcache)
|
||||
m.cliMgr.PutItem(remoteIp, hostName, name, clientVer, role, enableBcache, enableRCache)
|
||||
|
||||
if proto.IsCold(vol.VolType) && ver != proto.LFClient {
|
||||
sendErrReply(w, r, &proto.HTTPReply{Code: proto.ErrCodeParamError, Msg: "ec-vol is supported by LF client only"})
|
||||
|
||||
@ -30,7 +30,7 @@ func newClientMgr() *ClientMgr {
|
||||
return mgr
|
||||
}
|
||||
|
||||
func (cm *ClientMgr) PutItem(ip, host, vol, version, role, enableBcache string) {
|
||||
func (cm *ClientMgr) PutItem(ip, host, vol, version, role, enableBcache, enableRCache string) {
|
||||
cm.Lock()
|
||||
defer cm.Unlock()
|
||||
|
||||
@ -50,7 +50,7 @@ func (cm *ClientMgr) PutItem(ip, host, vol, version, role, enableBcache string)
|
||||
enableBcache = "false"
|
||||
}
|
||||
|
||||
key := fmt.Sprintf("_%s_%s_%s_%s_%s_enableBcache-%s", vol, version, role, ip, host, enableBcache)
|
||||
key := fmt.Sprintf("_%s_%s_%s_%s_%s_enableBcache-%s_enableRCache-%s", vol, version, role, ip, host, enableBcache, enableRCache)
|
||||
|
||||
if len(cm.clients) > maxClientCnt {
|
||||
log.LogWarnf("PutItem: too many record in cluster, ignore, key %s", key)
|
||||
|
||||
@ -416,6 +416,7 @@ const (
|
||||
ClientVerKey = "clientVer"
|
||||
RoleKey = "role"
|
||||
BcacheOnlyForNotSSDKey = "enableBcacheNotSSD"
|
||||
EnableRemoteCache = "enableRemoteCache"
|
||||
)
|
||||
|
||||
// const TimeFormat = "2006-01-02 15:04:05"
|
||||
|
||||
@ -30,6 +30,7 @@ import (
|
||||
"github.com/cubefs/cubefs/proto"
|
||||
"github.com/cubefs/cubefs/sdk/data/manager"
|
||||
"github.com/cubefs/cubefs/sdk/data/wrapper"
|
||||
"github.com/cubefs/cubefs/sdk/master"
|
||||
"github.com/cubefs/cubefs/sdk/meta"
|
||||
"github.com/cubefs/cubefs/util"
|
||||
"github.com/cubefs/cubefs/util/bloom"
|
||||
@ -427,7 +428,9 @@ func (client *ExtentClient) SetClientID(id uint64) (err error) {
|
||||
}
|
||||
|
||||
func (client *ExtentClient) IsRemoteCacheEnabled() bool {
|
||||
return client.RemoteCache.ClusterEnabled && client.RemoteCache.VolumeEnabled
|
||||
rcEnable := client.RemoteCache.ClusterEnabled && client.RemoteCache.VolumeEnabled
|
||||
master.ClientRCacheEnable = rcEnable
|
||||
return rcEnable
|
||||
}
|
||||
|
||||
func (client *ExtentClient) enableRemoteCacheCluster(enabled bool) {
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
"github.com/cubefs/cubefs/util/iputil"
|
||||
)
|
||||
|
||||
var BcacheOnlyForNotSSD bool
|
||||
var BcacheOnlyForNotSSD, ClientRCacheEnable bool
|
||||
|
||||
type Decoder func([]byte) ([]byte, error)
|
||||
|
||||
@ -93,6 +93,7 @@ func (api *ClientAPI) GetVolumeStat(volName string) (info *proto.VolStatInfo, er
|
||||
anyParam{proto.HostKey, iputil.HostName},
|
||||
anyParam{proto.RoleKey, proto.Role},
|
||||
anyParam{proto.BcacheOnlyForNotSSDKey, BcacheOnlyForNotSSD},
|
||||
anyParam{proto.EnableRemoteCache, ClientRCacheEnable},
|
||||
))
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user