|
|
@ -38,6 +38,8 @@ Steps to apply erasure coding to .dat .idx files |
|
|
|
// VolumeEcShardsGenerate generates the .ecx and .ec00 ~ .ec13 files
|
|
|
|
func (vs *VolumeServer) VolumeEcShardsGenerate(ctx context.Context, req *volume_server_pb.VolumeEcShardsGenerateRequest) (*volume_server_pb.VolumeEcShardsGenerateResponse, error) { |
|
|
|
|
|
|
|
glog.V(0).Infof("VolumeEcShardsGenerate: %v", req) |
|
|
|
|
|
|
|
v := vs.store.GetVolume(needle.VolumeId(req.VolumeId)) |
|
|
|
if v == nil { |
|
|
|
return nil, fmt.Errorf("volume %d not found", req.VolumeId) |
|
|
@ -69,6 +71,8 @@ func (vs *VolumeServer) VolumeEcShardsGenerate(ctx context.Context, req *volume_ |
|
|
|
// VolumeEcShardsRebuild generates the any of the missing .ec00 ~ .ec13 files
|
|
|
|
func (vs *VolumeServer) VolumeEcShardsRebuild(ctx context.Context, req *volume_server_pb.VolumeEcShardsRebuildRequest) (*volume_server_pb.VolumeEcShardsRebuildResponse, error) { |
|
|
|
|
|
|
|
glog.V(0).Infof("VolumeEcShardsRebuild: %v", req) |
|
|
|
|
|
|
|
baseFileName := erasure_coding.EcShardBaseFileName(req.Collection, int(req.VolumeId)) |
|
|
|
|
|
|
|
var rebuiltShardIds []uint32 |
|
|
@ -99,6 +103,8 @@ func (vs *VolumeServer) VolumeEcShardsRebuild(ctx context.Context, req *volume_s |
|
|
|
// VolumeEcShardsCopy copy the .ecx and some ec data slices
|
|
|
|
func (vs *VolumeServer) VolumeEcShardsCopy(ctx context.Context, req *volume_server_pb.VolumeEcShardsCopyRequest) (*volume_server_pb.VolumeEcShardsCopyResponse, error) { |
|
|
|
|
|
|
|
glog.V(0).Infof("VolumeEcShardsCopy: %v", req) |
|
|
|
|
|
|
|
location := vs.store.FindFreeLocation() |
|
|
|
if location == nil { |
|
|
|
return nil, fmt.Errorf("no space left") |
|
|
@ -213,6 +219,8 @@ func (vs *VolumeServer) VolumeEcShardsDelete(ctx context.Context, req *volume_se |
|
|
|
|
|
|
|
func (vs *VolumeServer) VolumeEcShardsMount(ctx context.Context, req *volume_server_pb.VolumeEcShardsMountRequest) (*volume_server_pb.VolumeEcShardsMountResponse, error) { |
|
|
|
|
|
|
|
glog.V(0).Infof("VolumeEcShardsMount: %v", req) |
|
|
|
|
|
|
|
for _, shardId := range req.ShardIds { |
|
|
|
err := vs.store.MountEcShards(req.Collection, needle.VolumeId(req.VolumeId), erasure_coding.ShardId(shardId)) |
|
|
|
|
|
|
@ -232,6 +240,8 @@ func (vs *VolumeServer) VolumeEcShardsMount(ctx context.Context, req *volume_ser |
|
|
|
|
|
|
|
func (vs *VolumeServer) VolumeEcShardsUnmount(ctx context.Context, req *volume_server_pb.VolumeEcShardsUnmountRequest) (*volume_server_pb.VolumeEcShardsUnmountResponse, error) { |
|
|
|
|
|
|
|
glog.V(0).Infof("VolumeEcShardsUnmount: %v", req) |
|
|
|
|
|
|
|
for _, shardId := range req.ShardIds { |
|
|
|
err := vs.store.UnmountEcShards(needle.VolumeId(req.VolumeId), erasure_coding.ShardId(shardId)) |
|
|
|
|
|
|
@ -319,6 +329,8 @@ func (vs *VolumeServer) VolumeEcShardRead(req *volume_server_pb.VolumeEcShardRea |
|
|
|
|
|
|
|
func (vs *VolumeServer) VolumeEcBlobDelete(ctx context.Context, req *volume_server_pb.VolumeEcBlobDeleteRequest) (*volume_server_pb.VolumeEcBlobDeleteResponse, error) { |
|
|
|
|
|
|
|
glog.V(0).Infof("VolumeEcBlobDelete: %v", req) |
|
|
|
|
|
|
|
resp := &volume_server_pb.VolumeEcBlobDeleteResponse{} |
|
|
|
|
|
|
|
for _, location := range vs.store.Locations { |
|
|
@ -347,6 +359,8 @@ func (vs *VolumeServer) VolumeEcBlobDelete(ctx context.Context, req *volume_serv |
|
|
|
// VolumeEcShardsToVolume generates the .idx, .dat files from .ecx, .ecj and .ec01 ~ .ec14 files
|
|
|
|
func (vs *VolumeServer) VolumeEcShardsToVolume(ctx context.Context, req *volume_server_pb.VolumeEcShardsToVolumeRequest) (*volume_server_pb.VolumeEcShardsToVolumeResponse, error) { |
|
|
|
|
|
|
|
glog.V(0).Infof("VolumeEcShardsToVolume: %v", req) |
|
|
|
|
|
|
|
v, found := vs.store.FindEcVolume(needle.VolumeId(req.VolumeId)) |
|
|
|
if !found { |
|
|
|
return nil, fmt.Errorf("ec volume %d not found", req.VolumeId) |
|
|
|