MountEcShards/UnmountEcShards updated for generation support

This commit is contained in:
chrislu
2025-08-10 14:09:07 -07:00
parent 8c31d5e331
commit 99f132729c
3 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -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)
+4 -2
View File
@@ -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
})
+3 -1
View File
@@ -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]