Fix S3 delete for non-empty directory markers (#8740)
* Fix S3 delete for non-empty directory markers * Address review feedback on directory marker deletes * Stabilize FUSE concurrent directory operations
This commit is contained in:
52
weed/mount/filehandle_test.go
Normal file
52
weed/mount/filehandle_test.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package mount
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
func TestFileHandleFullPathFallsBackAfterForget(t *testing.T) {
|
||||
wfs := &WFS{
|
||||
inodeToPath: NewInodeToPath(util.FullPath("/"), 0),
|
||||
}
|
||||
|
||||
fullPath := util.FullPath("/worker_0/subdir_0/test.txt")
|
||||
inode := wfs.inodeToPath.Lookup(fullPath, 1, false, false, 0, true)
|
||||
|
||||
fh := &FileHandle{
|
||||
inode: inode,
|
||||
wfs: wfs,
|
||||
}
|
||||
fh.RememberPath(fullPath)
|
||||
|
||||
wfs.inodeToPath.Forget(inode, 1, nil)
|
||||
|
||||
if got := fh.FullPath(); got != fullPath {
|
||||
t.Fatalf("FullPath() after forget = %q, want %q", got, fullPath)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileHandleFullPathUsesSavedRenamePathAfterForget(t *testing.T) {
|
||||
wfs := &WFS{
|
||||
inodeToPath: NewInodeToPath(util.FullPath("/"), 0),
|
||||
}
|
||||
|
||||
oldPath := util.FullPath("/worker_0/subdir_0/test.txt")
|
||||
newPath := util.FullPath("/worker_0/subdir_1/test.txt")
|
||||
inode := wfs.inodeToPath.Lookup(oldPath, 1, false, false, 0, true)
|
||||
|
||||
fh := &FileHandle{
|
||||
inode: inode,
|
||||
wfs: wfs,
|
||||
}
|
||||
fh.RememberPath(oldPath)
|
||||
|
||||
wfs.inodeToPath.MovePath(oldPath, newPath)
|
||||
fh.RememberPath(newPath)
|
||||
wfs.inodeToPath.Forget(inode, 1, nil)
|
||||
|
||||
if got := fh.FullPath(); got != newPath {
|
||||
t.Fatalf("FullPath() after rename+forget = %q, want %q", got, newPath)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user