From 0207f5fe9b9339575a266d1db566ad8589f86318 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 8 Sep 2021 15:54:55 -0700 Subject: [PATCH] replicated remote.cache --- weed/operation/assign_file_id.go | 2 +- weed/server/filer_grpc_server_remote.go | 3 +-- weed/server/volume_grpc_remote.go | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.go index e4b30f040..8dbdbbe57 100644 --- a/weed/operation/assign_file_id.go +++ b/weed/operation/assign_file_id.go @@ -74,7 +74,7 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest ret.PublicUrl = resp.PublicUrl ret.Error = resp.Error ret.Auth = security.EncodedJwt(resp.Auth) - for _, r := range ret.Replicas { + for _, r := range resp.Replicas { ret.Replicas = append(ret.Replicas, AssignResultReplica{ Url: r.Url, PublicUrl: r.PublicUrl, diff --git a/weed/server/filer_grpc_server_remote.go b/weed/server/filer_grpc_server_remote.go index 95cdb7003..c47356a8e 100644 --- a/weed/server/filer_grpc_server_remote.go +++ b/weed/server/filer_grpc_server_remote.go @@ -62,8 +62,7 @@ func (fs *FilerServer) DownloadToLocal(ctx context.Context, req *filer_pb.Downlo } // detect storage option - // replication level is set to "000" to ensure only need to ask one volume server to fetch the data. - so, err := fs.detectStorageOption(req.Directory, "", "000", 0, "", "", "") + so, err := fs.detectStorageOption(req.Directory, "", "", 0, "", "", "") if err != nil { return resp, err } diff --git a/weed/server/volume_grpc_remote.go b/weed/server/volume_grpc_remote.go index de7f2d594..aff57e52b 100644 --- a/weed/server/volume_grpc_remote.go +++ b/weed/server/volume_grpc_remote.go @@ -10,6 +10,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/storage/needle" "github.com/chrislusf/seaweedfs/weed/storage/types" "sync" + "time" ) func (vs *VolumeServer) FetchAndWriteNeedle(ctx context.Context, req *volume_server_pb.FetchAndWriteNeedleRequest) (resp *volume_server_pb.FetchAndWriteNeedleResponse, err error) { @@ -44,6 +45,8 @@ func (vs *VolumeServer) FetchAndWriteNeedle(ctx context.Context, req *volume_ser // copied from *Needle.prepareWriteBuffer() n.Size = 4 + types.Size(n.DataSize) + 1 n.Checksum = needle.NewCRC(n.Data) + n.LastModified = uint64(time.Now().Unix()) + n.SetHasLastModifiedDate() if _, localWriteErr := vs.store.WriteVolumeNeedle(v.Id, n, true, false); localWriteErr != nil { if err == nil { err = fmt.Errorf("local write needle %d size %d: %v", req.NeedleId, req.Size, err)