Browse Source

replicated remote.cache

pull/2327/head
Chris Lu 3 years ago
parent
commit
0207f5fe9b
  1. 2
      weed/operation/assign_file_id.go
  2. 3
      weed/server/filer_grpc_server_remote.go
  3. 3
      weed/server/volume_grpc_remote.go

2
weed/operation/assign_file_id.go

@ -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,

3
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 // 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 { if err != nil {
return resp, err return resp, err
} }

3
weed/server/volume_grpc_remote.go

@ -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)

Loading…
Cancel
Save