mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-13 11:34:22 +00:00
MountEcShards/UnmountEcShards updated for generation support
This commit is contained in:
@@ -324,7 +324,7 @@ func (vs *VolumeServer) VolumeEcShardsUnmount(ctx context.Context, req *volume_s
|
||||
glog.V(0).Infof("VolumeEcShardsUnmount: %v", req)
|
||||
|
||||
for _, shardId := range req.ShardIds {
|
||||
err := vs.store.UnmountEcShards(needle.VolumeId(req.VolumeId), erasure_coding.ShardId(shardId))
|
||||
err := vs.store.UnmountEcShards(needle.VolumeId(req.VolumeId), erasure_coding.ShardId(shardId), req.Generation)
|
||||
|
||||
if err != nil {
|
||||
glog.Errorf("ec shard unmount %v: %v", req, err)
|
||||
|
||||
@@ -441,8 +441,9 @@ func unmountEcShards(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, s
|
||||
|
||||
return operation.WithVolumeServerClient(false, sourceLocation, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
|
||||
_, deleteErr := volumeServerClient.VolumeEcShardsUnmount(context.Background(), &volume_server_pb.VolumeEcShardsUnmountRequest{
|
||||
VolumeId: uint32(volumeId),
|
||||
ShardIds: toBeUnmountedhardIds,
|
||||
VolumeId: uint32(volumeId),
|
||||
ShardIds: toBeUnmountedhardIds,
|
||||
Generation: 0, // shell commands operate on existing (generation 0) volumes
|
||||
})
|
||||
return deleteErr
|
||||
})
|
||||
@@ -457,6 +458,7 @@ func mountEcShards(grpcDialOption grpc.DialOption, collection string, volumeId n
|
||||
VolumeId: uint32(volumeId),
|
||||
Collection: collection,
|
||||
ShardIds: toBeMountedhardIds,
|
||||
Generation: 0, // shell commands operate on existing (generation 0) volumes
|
||||
})
|
||||
return mountErr
|
||||
})
|
||||
|
||||
@@ -62,6 +62,7 @@ func (s *Store) MountEcShards(collection string, vid needle.VolumeId, shardId er
|
||||
DiskType: string(location.DiskType),
|
||||
ExpireAtSec: ecVolume.ExpireAtSec,
|
||||
DiskId: uint32(diskId),
|
||||
Generation: generation, // include generation in mount message
|
||||
}
|
||||
return nil
|
||||
} else if err == os.ErrNotExist {
|
||||
@@ -74,7 +75,7 @@ func (s *Store) MountEcShards(collection string, vid needle.VolumeId, shardId er
|
||||
return fmt.Errorf("MountEcShards %d.%d not found on disk", vid, shardId)
|
||||
}
|
||||
|
||||
func (s *Store) UnmountEcShards(vid needle.VolumeId, shardId erasure_coding.ShardId) error {
|
||||
func (s *Store) UnmountEcShards(vid needle.VolumeId, shardId erasure_coding.ShardId, generation uint32) error {
|
||||
|
||||
diskId, ecShard, found := s.findEcShard(vid, shardId)
|
||||
if !found {
|
||||
@@ -88,6 +89,7 @@ func (s *Store) UnmountEcShards(vid needle.VolumeId, shardId erasure_coding.Shar
|
||||
EcIndexBits: uint32(shardBits.AddShardId(shardId)),
|
||||
DiskType: string(ecShard.DiskType),
|
||||
DiskId: diskId,
|
||||
Generation: generation, // include generation in unmount message
|
||||
}
|
||||
|
||||
location := s.Locations[diskId]
|
||||
|
||||
Reference in New Issue
Block a user