mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
This commit is contained in:
commit
38c63c429b
|
@ -2,13 +2,14 @@ package filer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
|
||||||
"github.com/viant/ptrie"
|
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||||
|
"github.com/viant/ptrie"
|
||||||
|
|
||||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/util"
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||||
|
@ -186,9 +187,12 @@ func (fsw *FilerStoreWrapper) DeleteEntry(ctx context.Context, fp util.FullPath)
|
||||||
}
|
}
|
||||||
if len(existingEntry.HardLinkId) != 0 {
|
if len(existingEntry.HardLinkId) != 0 {
|
||||||
// remove hard link
|
// remove hard link
|
||||||
glog.V(4).Infof("DeleteHardLink %s", existingEntry.FullPath)
|
op := ctx.Value("OP")
|
||||||
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil {
|
if op != "MV" {
|
||||||
return err
|
glog.V(4).Infof("DeleteHardLink %s", existingEntry.FullPath)
|
||||||
|
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,9 +210,12 @@ func (fsw *FilerStoreWrapper) DeleteOneEntry(ctx context.Context, existingEntry
|
||||||
|
|
||||||
if len(existingEntry.HardLinkId) != 0 {
|
if len(existingEntry.HardLinkId) != 0 {
|
||||||
// remove hard link
|
// remove hard link
|
||||||
glog.V(4).Infof("DeleteHardLink %s", existingEntry.FullPath)
|
op := ctx.Value("OP")
|
||||||
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil {
|
if op != "MV" {
|
||||||
return err
|
glog.V(4).Infof("DeleteHardLink %s", existingEntry.FullPath)
|
||||||
|
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,13 @@ package meta_cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/seaweedfs/seaweedfs/weed/filer"
|
"github.com/seaweedfs/seaweedfs/weed/filer"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/filer/leveldb"
|
"github.com/seaweedfs/seaweedfs/weed/filer/leveldb"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/util"
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||||
"os"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// need to have logic similar to FilerStoreWrapper
|
// need to have logic similar to FilerStoreWrapper
|
||||||
|
@ -76,6 +77,7 @@ func (mc *MetaCache) AtomicUpdateEntryFromFiler(ctx context.Context, oldPath uti
|
||||||
// skip the unnecessary deletion
|
// skip the unnecessary deletion
|
||||||
// leave the update to the following InsertEntry operation
|
// leave the update to the following InsertEntry operation
|
||||||
} else {
|
} else {
|
||||||
|
ctx = context.WithValue(ctx, "OP", "MV")
|
||||||
glog.V(3).Infof("DeleteEntry %s", oldPath)
|
glog.V(3).Infof("DeleteEntry %s", oldPath)
|
||||||
if err := mc.localStore.DeleteEntry(ctx, oldPath); err != nil {
|
if err := mc.localStore.DeleteEntry(ctx, oldPath); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -202,6 +202,7 @@ func (fs *FilerServer) moveSelfEntry(ctx context.Context, stream filer_pb.Seawee
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete old entry
|
// delete old entry
|
||||||
|
ctx = context.WithValue(ctx, "OP", "MV")
|
||||||
deleteErr := fs.filer.DeleteEntryMetaAndData(ctx, oldPath, false, false, false, false, signatures)
|
deleteErr := fs.filer.DeleteEntryMetaAndData(ctx, oldPath, false, false, false, false, signatures)
|
||||||
if deleteErr != nil {
|
if deleteErr != nil {
|
||||||
return deleteErr
|
return deleteErr
|
||||||
|
|
|
@ -337,7 +337,7 @@
|
||||||
}
|
}
|
||||||
var url = basePath + encodeURIComponent(newName);
|
var url = basePath + encodeURIComponent(newName);
|
||||||
var originPath = basePath + originName;
|
var originPath = basePath + originName;
|
||||||
url += '?mv.from=' + originPath;
|
url += '?mv.from=' + encodeURIComponent(originPath);
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', url, false);
|
xhr.open('POST', url, false);
|
||||||
xhr.setRequestHeader('Content-Type', '');
|
xhr.setRequestHeader('Content-Type', '');
|
||||||
|
|
Loading…
Reference in a new issue