mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(flashNode):evict stream when file is warmed
close:#1000150848 Signed-off-by: chihe <chihe@oppo.com>
This commit is contained in:
parent
497c4cb4c2
commit
1f0a1dbfc3
@ -766,8 +766,12 @@ func (c *CacheEngine) StartCachePrepareWorkers(flw *util.IoLimiter, prepareWorke
|
||||
for _, source := range r.Sources {
|
||||
reqSize += int(source.Size_)
|
||||
}
|
||||
bg := stat.BeginStat()
|
||||
var err error
|
||||
bg := stat.BeginStat()
|
||||
_, err3 := c.PeekCacheBlock(GenCacheBlockKey(r.Volume, r.Inode, r.FixedFileOffset, r.Version))
|
||||
if err3 == nil {
|
||||
continue
|
||||
}
|
||||
err1 := flw.Run(reqSize, true, func() {
|
||||
bk := GenCacheBlockKey(r.Volume, r.Inode, r.FixedFileOffset, r.Version)
|
||||
if log.EnableDebug() {
|
||||
|
||||
@ -13,6 +13,7 @@ type MetaWrapper interface {
|
||||
type ExtentApi interface {
|
||||
OpenStream(inode uint64, openForWrite, isCache bool, fullPath string) error
|
||||
CloseStream(inode uint64) error
|
||||
EvictStream(inode uint64) error
|
||||
Read(inode uint64, data []byte, offset int, size int, storageClass uint32, isMigration bool) (read int, err error)
|
||||
Flush(inode uint64) error
|
||||
Close() error
|
||||
|
||||
@ -117,6 +117,10 @@ func (m *MockExtentClient) CloseStream(inode uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockExtentClient) EvictStream(inode uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MockExtentClient) Read(inode uint64, data []byte, offset int, size int, storageClass uint32, isMigration bool) (read int, err error) {
|
||||
if isMigration {
|
||||
for i := 0; i < size; i++ {
|
||||
|
||||
@ -321,6 +321,10 @@ func (s *ManualScanner) warmUp(i *proto.ScanItem) error {
|
||||
log.LogWarnf("warmUp: ec OpenStream fail, inode(%v) err: %v", i.Inode, err)
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
s.ec.CloseStream(i.Inode)
|
||||
s.ec.EvictStream(i.Inode)
|
||||
}()
|
||||
if err = s.ec.ForceRefreshExtentsCache(i.Inode); err != nil {
|
||||
log.LogWarnf("warmUp: ec ForceRefreshExtentsCache fail, inode(%v) err: %v", i.Inode, err)
|
||||
return err
|
||||
|
||||
Loading…
Reference in New Issue
Block a user