mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
replicated remote.cache
This commit is contained in:
parent
00edcf71fc
commit
0207f5fe9b
|
@ -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,
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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…
Reference in a new issue