replicated remote.cache

This commit is contained in:
Chris Lu 2021-09-08 15:54:55 -07:00
parent 00edcf71fc
commit 0207f5fe9b
3 changed files with 5 additions and 3 deletions

View file

@ -74,7 +74,7 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest
ret.PublicUrl = resp.PublicUrl ret.PublicUrl = resp.PublicUrl
ret.Error = resp.Error ret.Error = resp.Error
ret.Auth = security.EncodedJwt(resp.Auth) ret.Auth = security.EncodedJwt(resp.Auth)
for _, r := range ret.Replicas { for _, r := range resp.Replicas {
ret.Replicas = append(ret.Replicas, AssignResultReplica{ ret.Replicas = append(ret.Replicas, AssignResultReplica{
Url: r.Url, Url: r.Url,
PublicUrl: r.PublicUrl, PublicUrl: r.PublicUrl,

View file

@ -62,8 +62,7 @@ func (fs *FilerServer) DownloadToLocal(ctx context.Context, req *filer_pb.Downlo
} }
// detect storage option // 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, "", "", 0, "", "", "")
so, err := fs.detectStorageOption(req.Directory, "", "000", 0, "", "", "")
if err != nil { if err != nil {
return resp, err return resp, err
} }

View file

@ -10,6 +10,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/storage/needle" "github.com/chrislusf/seaweedfs/weed/storage/needle"
"github.com/chrislusf/seaweedfs/weed/storage/types" "github.com/chrislusf/seaweedfs/weed/storage/types"
"sync" "sync"
"time"
) )
func (vs *VolumeServer) FetchAndWriteNeedle(ctx context.Context, req *volume_server_pb.FetchAndWriteNeedleRequest) (resp *volume_server_pb.FetchAndWriteNeedleResponse, err error) { 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() // copied from *Needle.prepareWriteBuffer()
n.Size = 4 + types.Size(n.DataSize) + 1 n.Size = 4 + types.Size(n.DataSize) + 1
n.Checksum = needle.NewCRC(n.Data) 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 _, localWriteErr := vs.store.WriteVolumeNeedle(v.Id, n, true, false); localWriteErr != nil {
if err == nil { if err == nil {
err = fmt.Errorf("local write needle %d size %d: %v", req.NeedleId, req.Size, err) err = fmt.Errorf("local write needle %d size %d: %v", req.NeedleId, req.Size, err)