SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix removing path from inode2path
chrislud24db396cc84
diff --git a/weed/mount/inode_to_path.go b/weed/mount/inode_to_path.goindex 6118d51cff..dd125f2502 100644--- a/weed/mount/inode_to_path.go+++ b/weed/mount/inode_to_path.go@@ -34,8 +34,8 @@ func (ie *InodeEntry) removeOnePath(p util.FullPath) bool {if idx < 0 {return false}- for x := len(ie.paths) - 2; x > idx; x-- {- ie.paths[x-1] = ie.paths[x]+ for x := idx; x < len(ie.paths)-1; x++ {+ ie.paths[x] = ie.paths[x+1]}ie.paths = ie.paths[0 : len(ie.paths)-1]return truediff --git a/weed/mount/inode_to_path_test.go b/weed/mount/inode_to_path_test.goindex b9723c4c57..0e7af21ee1 100644--- a/weed/mount/inode_to_path_test.go+++ b/weed/mount/inode_to_path_test.go@@ -13,6 +13,15 @@ func TestInodeEntry_removeOnePath(t *testing.T) {want boolcount int}{+ {+ name: "actual case",+ entry: InodeEntry{+ paths: []util.FullPath{"/pjd/nx", "/pjd/n0"},+ },+ p: "/pjd/nx",+ want: true,+ count: 1,+ },{name: "empty",entry: InodeEntry{},@@ -74,6 +83,11 @@ func TestInodeEntry_removeOnePath(t *testing.T) {if tt.count != len(tt.entry.paths) {t.Errorf("removeOnePath path count = %v, want %v", len(tt.entry.paths), tt.count)}+ for i, p := range tt.entry.paths {+ if p == tt.p {+ t.Errorf("removeOnePath found path still exists at %v, %v", i, p)+ }+ }})}}