Skip to content

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.

more test cases

Chris Luc0283eee1ad1
diff --git a/weed/util/bounded_tree/bounded_tree.go b/weed/util/bounded_tree/bounded_tree.go
index efe2ff93a8..8c99ad83df 100644
--- a/weed/util/bounded_tree/bounded_tree.go
+++ b/weed/util/bounded_tree/bounded_tree.go
@@ -1,8 +1,6 @@
package bounded_tree
import (
- "fmt"
-
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util"
)
@@ -135,7 +133,7 @@ func (t *BoundedTree) HasVisited(p util.FullPath) bool {
}
components := p.Split()
- fmt.Printf("components %v %d\n", components, len(components))
+ // fmt.Printf("components %v %d\n", components, len(components))
return t.hasVisited(t.root, util.FullPath("/"), components, 0)
}
@@ -149,7 +147,7 @@ func (t *BoundedTree) hasVisited(n *Node, currentPath util.FullPath, components
return false
}
- fmt.Printf(" hasVisited child %v %+v %d\n", currentPath, components, i)
+ // fmt.Printf(" hasVisited child %v %+v %d\n", currentPath, components, i)
if i >= len(components) {
return true
diff --git a/weed/util/bounded_tree/bounded_tree_test.go b/weed/util/bounded_tree/bounded_tree_test.go
index 331cc46c06..2328f0497e 100644
--- a/weed/util/bounded_tree/bounded_tree_test.go
+++ b/weed/util/bounded_tree/bounded_tree_test.go
@@ -62,6 +62,15 @@ func TestBoundedTree(t *testing.T) {
tree.EnsureVisited(util.FullPath("/a/b/c"), visitFn)
assert.Equal(t, true, tree.HasVisited(util.FullPath("/a/b")))
+ assert.Equal(t, true, tree.HasVisited(util.FullPath("/a/b/c")))
+ assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/c/d")))
+ assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/e")))
+ assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/f")))
+ assert.Equal(t, false, tree.HasVisited(util.FullPath("/g")))
+ assert.Equal(t, false, tree.HasVisited(util.FullPath("/h")))
+ assert.Equal(t, true, tree.HasVisited(util.FullPath("/")))
+ assert.Equal(t, true, tree.HasVisited(util.FullPath("/x")))
+ assert.Equal(t, false, tree.HasVisited(util.FullPath("/a/b/e/x")))
printMap(tree.root.Children)