aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-08-06 10:04:17 -0700
committerChris Lu <chris.lu@gmail.com>2020-08-06 10:04:17 -0700
commit20e2ac1add0e93710d54f41c8ba142918c60d620 (patch)
tree4fadb3236551f8aab1037bc6f6ec5351f169fcea /weed/filesys
parent93ea0801ea65375c16f148c9e77056e6c145f770 (diff)
downloadseaweedfs-20e2ac1add0e93710d54f41c8ba142918c60d620.tar.xz
seaweedfs-20e2ac1add0e93710d54f41c8ba142918c60d620.zip
filer: store md5 metadata for files uploaded by filer
fix https://github.com/chrislusf/seaweedfs/issues/1412
Diffstat (limited to 'weed/filesys')
-rw-r--r--weed/filesys/filehandle.go9
-rw-r--r--weed/filesys/wfs.go2
2 files changed, 8 insertions, 3 deletions
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index ca35bfd02..b9d224fb2 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -9,11 +9,12 @@ import (
"os"
"time"
+ "github.com/seaweedfs/fuse"
+ "github.com/seaweedfs/fuse/fs"
+
"github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
- "github.com/seaweedfs/fuse"
- "github.com/seaweedfs/fuse/fs"
)
type FileHandle struct {
@@ -225,6 +226,10 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
fh.f.entry.Chunks = chunks
// fh.f.entryViewCache = nil
+ // special handling of one chunk md5
+ if len(chunks) == 1 {
+ }
+
if err := filer_pb.CreateEntry(client, request); err != nil {
glog.Errorf("fh flush create %s: %v", fh.f.fullpath(), err)
return fmt.Errorf("fh flush create %s: %v", fh.f.fullpath(), err)
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 68ad987be..9ef597024 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -82,7 +82,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
},
},
}
- cacheUniqueId := util.Md5([]byte(option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:4]
+ cacheUniqueId := util.Base64Md5([]byte(option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:4]
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
if option.CacheSizeMB > 0 {
os.MkdirAll(cacheDir, 0755)