mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Fix large file chunks deleted by mistake (#4678)
This commit is contained in:
parent
358b3a4894
commit
33b9192536
|
@ -1,11 +1,12 @@
|
||||||
package mount
|
package mount
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hanwen/go-fuse/v2/fuse"
|
|
||||||
sys "golang.org/x/sys/unix"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/hanwen/go-fuse/v2/fuse"
|
||||||
|
sys "golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -131,6 +132,11 @@ func (wfs *WFS) SetXAttr(cancel <-chan struct{}, input *fuse.SetXAttrIn, attr st
|
||||||
entry.Extended[XATTR_PREFIX+attr] = data
|
entry.Extended[XATTR_PREFIX+attr] = data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fh != nil {
|
||||||
|
fh.dirtyMetadata = true
|
||||||
|
return fuse.OK
|
||||||
|
}
|
||||||
|
|
||||||
return wfs.saveEntry(path, entry)
|
return wfs.saveEntry(path, entry)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,13 @@ package weed_server
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
||||||
|
|
||||||
"github.com/seaweedfs/seaweedfs/weed/filer"
|
"github.com/seaweedfs/seaweedfs/weed/filer"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/operation"
|
"github.com/seaweedfs/seaweedfs/weed/operation"
|
||||||
|
@ -157,7 +158,7 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
|
||||||
createErr := fs.filer.CreateEntry(ctx, newEntry, req.OExcl, req.IsFromOtherCluster, req.Signatures, req.SkipCheckParentDirectory)
|
createErr := fs.filer.CreateEntry(ctx, newEntry, req.OExcl, req.IsFromOtherCluster, req.Signatures, req.SkipCheckParentDirectory)
|
||||||
|
|
||||||
if createErr == nil {
|
if createErr == nil {
|
||||||
fs.filer.DeleteChunks(garbage)
|
fs.filer.DeleteChunksNotRecursive(garbage)
|
||||||
} else {
|
} else {
|
||||||
glog.V(3).Infof("CreateEntry %s: %v", filepath.Join(req.Directory, req.Entry.Name), createErr)
|
glog.V(3).Infof("CreateEntry %s: %v", filepath.Join(req.Directory, req.Entry.Name), createErr)
|
||||||
resp.Error = createErr.Error()
|
resp.Error = createErr.Error()
|
||||||
|
@ -189,7 +190,7 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = fs.filer.UpdateEntry(ctx, entry, newEntry); err == nil {
|
if err = fs.filer.UpdateEntry(ctx, entry, newEntry); err == nil {
|
||||||
fs.filer.DeleteChunks(garbage)
|
fs.filer.DeleteChunksNotRecursive(garbage)
|
||||||
|
|
||||||
fs.filer.NotifyUpdateEvent(ctx, entry, newEntry, true, req.IsFromOtherCluster, req.Signatures)
|
fs.filer.NotifyUpdateEvent(ctx, entry, newEntry, true, req.IsFromOtherCluster, req.Signatures)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue