Skip to content

Commit

Permalink
cmd/sync: skip special files in juicefs (#5523)
Browse files Browse the repository at this point in the history
Signed-off-by: jiefenghuang <[email protected]>
  • Loading branch information
jiefenghuang authored Jan 7, 2025
1 parent e2a4be5 commit b886cc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ var bufPool = sync.Pool{
}

func (j *juiceFS) Put(key string, in io.Reader, getters ...object.AttrGetter) (err error) {
if vfs.IsSpecialName(key) {
return fmt.Errorf("skip special file %s for jfs: %w", key, utils.ErrSkipped)
}
p := j.path(key)
if strings.HasSuffix(p, "/") {
eno := j.jfs.MkdirAll(ctx, p, 0777, j.umask)
Expand Down
4 changes: 3 additions & 1 deletion pkg/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ var bufPool = sync.Pool{
func try(n int, f func() error) (err error) {
for i := 0; i < n; i++ {
err = f()
if err == nil {
if err == nil || errors.Is(err, utils.ErrSkipped) {
return
}
logger.Debugf("Try %d failed: %s", i+1, err)
Expand Down Expand Up @@ -697,6 +697,8 @@ func worker(tasks <-chan object.Object, src, dst object.ObjectStorage, config *C
copyPerms(dst, obj, config)
}
copied.Increment()
} else if errors.Is(err, utils.ErrSkipped) {
skipped.Increment()
} else {
failed.Increment()
logger.Errorf("Failed to copy object %s: %s", key, err)
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ import (
var (
ENOTSUP = errors.New("not supported")
ErrFuncTimeout = errors.New("function timeout")
ErrSkipped = errors.New("skipped")
)

0 comments on commit b886cc2

Please sign in to comment.