mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
chore(datanode): change checking interval from hour to minute.#1000005968
Signed-off-by: Wu Huocheng <wuhuocheng@oppo.com>
This commit is contained in:
parent
ae766477e7
commit
df6a12c5d6
@ -1503,7 +1503,7 @@ func (dp *DataPartition) setRestoreReplicaFinish() bool {
|
||||
}
|
||||
|
||||
func (dp *DataPartition) EvictExtentCache() {
|
||||
err := dp.extentStore.DoExtentCacheTtl(dp.dataNode.ExtentCacheTtlByHour)
|
||||
err := dp.extentStore.DoExtentCacheTtl(dp.dataNode.ExtentCacheTtlByMin)
|
||||
if err != nil {
|
||||
log.LogWarnf("[EvictExtentCache] DoExtentCacheTtl err: %s", err.Error())
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ const (
|
||||
DefaultDiskUnavailableErrorCount = 5
|
||||
DefaultDiskUnavailablePartitionErrorCount = 3
|
||||
DefaultGOGCValue = 100
|
||||
DefaultExtentCacheTtlByHour = 1
|
||||
DefaultExtentCacheTtlByMin = 30
|
||||
)
|
||||
|
||||
const (
|
||||
@ -137,7 +137,7 @@ const (
|
||||
// disk status becomes unavailable if disk error partition count reaches this value
|
||||
ConfigKeyDiskUnavailablePartitionErrorCount = "diskUnavailablePartitionErrorCount"
|
||||
ConfigKeyCacheCap = "cacheCap"
|
||||
ConfigExtentCacheTtlByHour = "extentCacheTtlByHour"
|
||||
ConfigExtentCacheTtlByMin = "extentCacheTtlByMin"
|
||||
|
||||
// storage device media type, for hybrid cloud, in string: SDD or HDD
|
||||
ConfigMediaType = "mediaType"
|
||||
@ -223,7 +223,7 @@ type DataNode struct {
|
||||
VolsForbidWriteOpOfProtoVer0 map[string]struct{} // whether forbid by volume granularity,
|
||||
DirectReadVols map[string]struct{}
|
||||
IgnoreTinyRecoverVols map[string]struct{}
|
||||
ExtentCacheTtlByHour int
|
||||
ExtentCacheTtlByMin int
|
||||
}
|
||||
|
||||
type verOp2Phase struct {
|
||||
@ -478,7 +478,7 @@ func (s *DataNode) parseConfig(cfg *config.Config) (err error) {
|
||||
}
|
||||
s.mediaType = mediaType
|
||||
|
||||
s.ExtentCacheTtlByHour = cfg.GetIntWithDefault(ConfigExtentCacheTtlByHour, DefaultExtentCacheTtlByHour)
|
||||
s.ExtentCacheTtlByMin = cfg.GetIntWithDefault(ConfigExtentCacheTtlByMin, DefaultExtentCacheTtlByMin)
|
||||
|
||||
log.LogDebugf("action[parseConfig] load masterAddrs(%v).", MasterClient.Nodes())
|
||||
log.LogDebugf("action[parseConfig] load port(%v).", s.port)
|
||||
|
||||
@ -969,7 +969,11 @@ func (manager *SpaceManager) getPartitions() []*DataPartition {
|
||||
}
|
||||
|
||||
func (manager *SpaceManager) StartEvictExtentCache() {
|
||||
ticker := time.NewTicker(time.Hour)
|
||||
interval := manager.dataNode.ExtentCacheTtlByMin / 2
|
||||
if interval <= 0 {
|
||||
interval = 1
|
||||
}
|
||||
ticker := time.NewTicker(time.Minute * time.Duration(interval))
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
|
||||
@ -224,7 +224,7 @@ func (cache *ExtentCache) Flush() {
|
||||
}
|
||||
|
||||
func (cache *ExtentCache) EvictTTL(ttl int) error {
|
||||
cmpTime := timeutil.GetCurrentTimeUnix() - int64(ttl)*int64(time.Hour)
|
||||
cmpTime := timeutil.GetCurrentTimeUnix() - int64(ttl)*int64(time.Minute)
|
||||
if cache.capacity <= 0 || cmpTime <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user