Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

bugfix: reduce error logs when download home dir not exist #960

Merged
merged 1 commit into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions supernode/daemon/mgr/cdn/cache_detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/dragonflyoss/Dragonfly/supernode/httpclient"
"github.com/dragonflyoss/Dragonfly/supernode/store"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -59,7 +60,7 @@ func (cd *cacheDetector) detectCache(ctx context.Context, task *types.TaskInfo)

if breakNum == 0 {
if metaData, err = cd.resetRepo(ctx, task); err != nil {
return 0, nil, err
return 0, nil, errors.Wrapf(err, "failed to reset repo")
}
} else {
logrus.Debugf("start to update access time with taskID(%s)", task.ID)
Expand Down Expand Up @@ -120,7 +121,7 @@ func (cd *cacheDetector) parseBreakNumByCheckFile(ctx context.Context, taskID st
func (cd *cacheDetector) resetRepo(ctx context.Context, task *types.TaskInfo) (*fileMetaData, error) {
logrus.Infof("reset repo for taskID: %s", task.ID)
if err := deleteTaskFiles(ctx, cd.cacheStore, task.ID); err != nil {
return nil, err
logrus.Errorf("reset repo: failed to delete task(%s) files: %v", task.ID, err)
}

return cd.metaDataManager.writeFileMetaDataByTask(ctx, task)
Expand Down
6 changes: 5 additions & 1 deletion supernode/daemon/mgr/cdn/cdn_gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (

"github.com/emirpasic/gods/maps/treemap"
godsutils "github.com/emirpasic/gods/utils"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)

Expand All @@ -41,7 +42,10 @@ func (cm *Manager) GetGCTaskIDs(ctx context.Context, taskMgr mgr.TaskMgr) ([]str

freeDisk, err := cm.cacheStore.GetAvailSpace(ctx, getHomeRawFunc())
if err != nil {
return nil, err
if store.IsKeyNotFound(err) {
return nil, nil
}
return nil, errors.Wrapf(err, "failed to get avail space")
}
if freeDisk > cm.cfg.YoungGCThreshold {
return nil, nil
Expand Down
2 changes: 1 addition & 1 deletion supernode/store/local_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func (ls *localStorage) statPath(bucket, key string) (string, os.FileInfo, error
f, err := os.Stat(filePath)
if err != nil {
if os.IsNotExist(err) {
return "", nil, errors.Wrapf(ErrKeyNotFound, "key: %s", key)
return "", nil, errors.Wrapf(ErrKeyNotFound, "bucket(%s) key(%s)", bucket, key)
}
return "", nil, err
}
Expand Down