diff --git a/weed/server/volume_grpc_erasure_coding.go b/weed/server/volume_grpc_erasure_coding.go index a90747ba4..6d4ff623e 100644 --- a/weed/server/volume_grpc_erasure_coding.go +++ b/weed/server/volume_grpc_erasure_coding.go @@ -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) diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.go index 8bef78394..2ed4dd354 100644 --- a/weed/shell/command_ec_common.go +++ b/weed/shell/command_ec_common.go @@ -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 }) diff --git a/weed/storage/store_ec.go b/weed/storage/store_ec.go index b255ee80d..493ad660d 100644 --- a/weed/storage/store_ec.go +++ b/weed/storage/store_ec.go @@ -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]