diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-04-19 00:39:34 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-04-19 00:39:34 -0700 |
| commit | ac2727853f94c8fc4e301a995997f02b70047853 (patch) | |
| tree | 6f311ab03450e622f281fa6d18025d263ede7825 /weed/server | |
| parent | e5506152c0a27d38fa334b2e338d82ee02669ab9 (diff) | |
| download | seaweedfs-ac2727853f94c8fc4e301a995997f02b70047853.tar.xz seaweedfs-ac2727853f94c8fc4e301a995997f02b70047853.zip | |
fix needle map entry size
Diffstat (limited to 'weed/server')
| -rw-r--r-- | weed/server/volume_grpc_copy.go | 19 | ||||
| -rw-r--r-- | weed/server/volume_grpc_copy_incremental.go | 4 |
2 files changed, 13 insertions, 10 deletions
diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.go index b7789f88d..0cb5bb455 100644 --- a/weed/server/volume_grpc_copy.go +++ b/weed/server/volume_grpc_copy.go @@ -3,15 +3,15 @@ package weed_server import ( "context" "fmt" + "io" + "os" + "time" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb" "github.com/chrislusf/seaweedfs/weed/storage" "github.com/chrislusf/seaweedfs/weed/storage/needle" - - "io" - "os" ) // VolumeCopy copy the .idx .dat files, and mount the volume @@ -96,7 +96,9 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo return nil, fmt.Errorf("failed to mount volume %d: %v", req.VolumeId, err) } - return &volume_server_pb.VolumeCopyResponse{}, err + return &volume_server_pb.VolumeCopyResponse{ + LastAppendAtNs:volFileInfoResp.DatFileTimestampSeconds*uint64(time.Second), + }, err } /** @@ -153,10 +155,11 @@ func (vs *VolumeServer) ReadVolumeFileStatus(ctx context.Context, req *volume_se } resp.VolumeId = req.VolumeId - resp.DatFileSize = v.DataFileSize() - resp.IdxFileSize = v.IndexFileSize() - resp.DatFileTimestamp = v.LastModifiedTime() - resp.IdxFileTimestamp = v.LastModifiedTime() + datSize, idxSize, modTime := v.FileStat() + resp.DatFileSize = datSize + resp.IdxFileSize = idxSize + resp.DatFileTimestampSeconds = uint64(modTime.Unix()) + resp.IdxFileTimestampSeconds = uint64(modTime.Unix()) resp.FileCount = v.FileCount() return resp, nil } diff --git a/weed/server/volume_grpc_copy_incremental.go b/weed/server/volume_grpc_copy_incremental.go index 5977c44f6..f56fbeef4 100644 --- a/weed/server/volume_grpc_copy_incremental.go +++ b/weed/server/volume_grpc_copy_incremental.go @@ -17,7 +17,7 @@ func (vs *VolumeServer) VolumeIncrementalCopy(req *volume_server_pb.VolumeIncrem return fmt.Errorf("not found volume id %d", req.VolumeId) } - stopOffset := v.Size() + stopOffset, _, _ := v.FileStat() foundOffset, isLastOne, err := v.BinarySearchByAppendAtNs(req.SinceNs) if err != nil { return fmt.Errorf("fail to locate by appendAtNs %d: %s", req.SinceNs, err) @@ -30,7 +30,7 @@ func (vs *VolumeServer) VolumeIncrementalCopy(req *volume_server_pb.VolumeIncrem startOffset := foundOffset.ToAcutalOffset() buf := make([]byte, 1024*1024*2) - return sendFileContent(v.DataFile(), buf, startOffset, stopOffset, stream) + return sendFileContent(v.DataFile(), buf, startOffset, int64(stopOffset), stream) } |
