diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-10-16 23:33:45 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-10-16 23:33:45 -0700 |
| commit | 0ccdb937bba225ac6c170e6f5f1d8a3065ff56a7 (patch) | |
| tree | 9997a33597d6fae916cdce5710d12fe839966828 /weed/filesys/meta_cache | |
| parent | b9a2efd69b1fc8a3fbab85038f3b03c6947f2c62 (diff) | |
| download | seaweedfs-0ccdb937bba225ac6c170e6f5f1d8a3065ff56a7.tar.xz seaweedfs-0ccdb937bba225ac6c170e6f5f1d8a3065ff56a7.zip | |
mount: fix renaming a deep directory with unvisited directories
Diffstat (limited to 'weed/filesys/meta_cache')
| -rw-r--r-- | weed/filesys/meta_cache/meta_cache.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/weed/filesys/meta_cache/meta_cache.go b/weed/filesys/meta_cache/meta_cache.go index 69d1655ee..6630a7739 100644 --- a/weed/filesys/meta_cache/meta_cache.go +++ b/weed/filesys/meta_cache/meta_cache.go @@ -2,10 +2,10 @@ package meta_cache import ( "context" - "fmt" "github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/filer/leveldb" "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util/bounded_tree" "os" @@ -117,12 +117,15 @@ func (mc *MetaCache) DeleteEntry(ctx context.Context, fp util.FullPath) (err err return mc.localStore.DeleteEntry(ctx, fp) } -func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) error { +func (mc *MetaCache) ListDirectoryEntries(ctx context.Context, client filer_pb.FilerClient, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) error { //mc.RLock() //defer mc.RUnlock() if !mc.visitedBoundary.HasVisited(dirPath) { - return fmt.Errorf("unsynchronized dir: %v", dirPath) + glog.V(2).Infof("visit unsynchronized dir: %v", dirPath) + // this should not happen often + // unless, e.g., moving a deep directory + EnsureVisited(mc, client, dirPath) } _, err := mc.localStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit, func(entry *filer.Entry) bool { |
