From 0c932d17384f9bfcccf5dd523289165fe3083b45 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 29 Dec 2018 00:03:30 -0800 Subject: [PATCH] add volume delete grpc API fix https://github.com/chrislusf/seaweedfs/issues/808 --- weed/pb/volume_server.proto | 8 + weed/pb/volume_server_pb/volume_server.pb.go | 201 ++++++++++++------- weed/server/volume_grpc_admin.go | 16 ++ weed/storage/store.go | 12 ++ 4 files changed, 168 insertions(+), 69 deletions(-) diff --git a/weed/pb/volume_server.proto b/weed/pb/volume_server.proto index 8e570f4eb..8ab67a1bf 100644 --- a/weed/pb/volume_server.proto +++ b/weed/pb/volume_server.proto @@ -33,6 +33,8 @@ service VolumeServer { } rpc VolumeUnmount (VolumeUnmountRequest) returns (VolumeUnmountResponse) { } + rpc VolumeDelete (VolumeDeleteRequest) returns (VolumeDeleteResponse) { + } // rpc VolumeUiPage (VolumeUiPageRequest) returns (VolumeUiPageResponse) {} @@ -142,6 +144,12 @@ message VolumeUnmountRequest { message VolumeUnmountResponse { } +message VolumeDeleteRequest { + uint32 volumd_id = 1; +} +message VolumeDeleteResponse { +} + message VolumeUiPageRequest { } message VolumeUiPageResponse { diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.go index 58964766d..fa700e2e5 100644 --- a/weed/pb/volume_server_pb/volume_server.pb.go +++ b/weed/pb/volume_server_pb/volume_server.pb.go @@ -35,6 +35,8 @@ It has these top-level messages: VolumeMountResponse VolumeUnmountRequest VolumeUnmountResponse + VolumeDeleteRequest + VolumeDeleteResponse VolumeUiPageRequest VolumeUiPageResponse DiskStatus @@ -558,13 +560,37 @@ func (m *VolumeUnmountResponse) String() string { return proto.Compac func (*VolumeUnmountResponse) ProtoMessage() {} func (*VolumeUnmountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } +type VolumeDeleteRequest struct { + VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"` +} + +func (m *VolumeDeleteRequest) Reset() { *m = VolumeDeleteRequest{} } +func (m *VolumeDeleteRequest) String() string { return proto.CompactTextString(m) } +func (*VolumeDeleteRequest) ProtoMessage() {} +func (*VolumeDeleteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } + +func (m *VolumeDeleteRequest) GetVolumdId() uint32 { + if m != nil { + return m.VolumdId + } + return 0 +} + +type VolumeDeleteResponse struct { +} + +func (m *VolumeDeleteResponse) Reset() { *m = VolumeDeleteResponse{} } +func (m *VolumeDeleteResponse) String() string { return proto.CompactTextString(m) } +func (*VolumeDeleteResponse) ProtoMessage() {} +func (*VolumeDeleteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } + type VolumeUiPageRequest struct { } func (m *VolumeUiPageRequest) Reset() { *m = VolumeUiPageRequest{} } func (m *VolumeUiPageRequest) String() string { return proto.CompactTextString(m) } func (*VolumeUiPageRequest) ProtoMessage() {} -func (*VolumeUiPageRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } +func (*VolumeUiPageRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } type VolumeUiPageResponse struct { } @@ -572,7 +598,7 @@ type VolumeUiPageResponse struct { func (m *VolumeUiPageResponse) Reset() { *m = VolumeUiPageResponse{} } func (m *VolumeUiPageResponse) String() string { return proto.CompactTextString(m) } func (*VolumeUiPageResponse) ProtoMessage() {} -func (*VolumeUiPageResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } +func (*VolumeUiPageResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } type DiskStatus struct { Dir string `protobuf:"bytes,1,opt,name=dir" json:"dir,omitempty"` @@ -584,7 +610,7 @@ type DiskStatus struct { func (m *DiskStatus) Reset() { *m = DiskStatus{} } func (m *DiskStatus) String() string { return proto.CompactTextString(m) } func (*DiskStatus) ProtoMessage() {} -func (*DiskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } +func (*DiskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } func (m *DiskStatus) GetDir() string { if m != nil { @@ -627,7 +653,7 @@ type MemStatus struct { func (m *MemStatus) Reset() { *m = MemStatus{} } func (m *MemStatus) String() string { return proto.CompactTextString(m) } func (*MemStatus) ProtoMessage() {} -func (*MemStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } +func (*MemStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} } func (m *MemStatus) GetGoroutines() int32 { if m != nil { @@ -705,6 +731,8 @@ func init() { proto.RegisterType((*VolumeMountResponse)(nil), "volume_server_pb.VolumeMountResponse") proto.RegisterType((*VolumeUnmountRequest)(nil), "volume_server_pb.VolumeUnmountRequest") proto.RegisterType((*VolumeUnmountResponse)(nil), "volume_server_pb.VolumeUnmountResponse") + proto.RegisterType((*VolumeDeleteRequest)(nil), "volume_server_pb.VolumeDeleteRequest") + proto.RegisterType((*VolumeDeleteResponse)(nil), "volume_server_pb.VolumeDeleteResponse") proto.RegisterType((*VolumeUiPageRequest)(nil), "volume_server_pb.VolumeUiPageRequest") proto.RegisterType((*VolumeUiPageResponse)(nil), "volume_server_pb.VolumeUiPageResponse") proto.RegisterType((*DiskStatus)(nil), "volume_server_pb.DiskStatus") @@ -735,6 +763,7 @@ type VolumeServerClient interface { VolumeSyncData(ctx context.Context, in *VolumeSyncDataRequest, opts ...grpc.CallOption) (VolumeServer_VolumeSyncDataClient, error) VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error) VolumeUnmount(ctx context.Context, in *VolumeUnmountRequest, opts ...grpc.CallOption) (*VolumeUnmountResponse, error) + VolumeDelete(ctx context.Context, in *VolumeDeleteRequest, opts ...grpc.CallOption) (*VolumeDeleteResponse, error) } type volumeServerClient struct { @@ -899,6 +928,15 @@ func (c *volumeServerClient) VolumeUnmount(ctx context.Context, in *VolumeUnmoun return out, nil } +func (c *volumeServerClient) VolumeDelete(ctx context.Context, in *VolumeDeleteRequest, opts ...grpc.CallOption) (*VolumeDeleteResponse, error) { + out := new(VolumeDeleteResponse) + err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeDelete", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for VolumeServer service type VolumeServerServer interface { @@ -915,6 +953,7 @@ type VolumeServerServer interface { VolumeSyncData(*VolumeSyncDataRequest, VolumeServer_VolumeSyncDataServer) error VolumeMount(context.Context, *VolumeMountRequest) (*VolumeMountResponse, error) VolumeUnmount(context.Context, *VolumeUnmountRequest) (*VolumeUnmountResponse, error) + VolumeDelete(context.Context, *VolumeDeleteRequest) (*VolumeDeleteResponse, error) } func RegisterVolumeServerServer(s *grpc.Server, srv VolumeServerServer) { @@ -1143,6 +1182,24 @@ func _VolumeServer_VolumeUnmount_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _VolumeServer_VolumeDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VolumeDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VolumeServerServer).VolumeDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/volume_server_pb.VolumeServer/VolumeDelete", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VolumeServerServer).VolumeDelete(ctx, req.(*VolumeDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _VolumeServer_serviceDesc = grpc.ServiceDesc{ ServiceName: "volume_server_pb.VolumeServer", HandlerType: (*VolumeServerServer)(nil), @@ -1187,6 +1244,10 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{ MethodName: "VolumeUnmount", Handler: _VolumeServer_VolumeUnmount_Handler, }, + { + MethodName: "VolumeDelete", + Handler: _VolumeServer_VolumeDelete_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -1206,69 +1267,71 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1015 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x57, 0x5f, 0x73, 0xdb, 0x44, - 0x10, 0x8f, 0x62, 0x3b, 0x76, 0xd6, 0x36, 0x35, 0xe7, 0x34, 0x51, 0x55, 0x08, 0x46, 0x40, 0xeb, - 0xb4, 0x21, 0x40, 0x3b, 0x40, 0x19, 0x5e, 0x80, 0x04, 0x98, 0x3c, 0x74, 0xca, 0x5c, 0xa6, 0x1d, - 0x66, 0xe8, 0x8c, 0x47, 0x91, 0xce, 0xce, 0x11, 0x59, 0x52, 0x75, 0xa7, 0x4c, 0xca, 0x77, 0xe0, - 0x03, 0xf0, 0xcc, 0x0b, 0xdf, 0x91, 0x17, 0xe6, 0xfe, 0x48, 0xd1, 0x3f, 0xd7, 0x02, 0xde, 0x4e, - 0xbf, 0xdb, 0xfd, 0xed, 0xed, 0xde, 0xde, 0xfe, 0x6c, 0x18, 0x5f, 0x85, 0x7e, 0xb2, 0x24, 0x33, - 0x46, 0xe2, 0x2b, 0x12, 0x1f, 0x45, 0x71, 0xc8, 0x43, 0x34, 0x2a, 0x80, 0xb3, 0xe8, 0xdc, 0xfe, - 0x04, 0xd0, 0x77, 0x0e, 0x77, 0x2f, 0x4e, 0x88, 0x4f, 0x38, 0xc1, 0xe4, 0x55, 0x42, 0x18, 0x47, - 0x77, 0xa0, 0x37, 0xa7, 0x3e, 0x99, 0x51, 0x8f, 0x99, 0xc6, 0xa4, 0x35, 0xdd, 0xc6, 0x5d, 0xf1, - 0x7d, 0xea, 0x31, 0xfb, 0x19, 0x8c, 0x0b, 0x0e, 0x2c, 0x0a, 0x03, 0x46, 0xd0, 0x13, 0xe8, 0xc6, - 0x84, 0x25, 0x3e, 0x57, 0x0e, 0xf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x20, - 0x2f, 0x8c, 0xa8, 0xa6, 0xe9, 0x6a, 0x24, 0xde, 0xba, 0xb7, 0xce, 0x2c, 0x9f, 0x4d, 0x59, 0x28, - 0xeb, 0xb2, 0x59, 0xa1, 0xc2, 0x75, 0xd9, 0xac, 0xd2, 0x5d, 0x7b, 0x03, 0xfd, 0x0a, 0xb7, 0x4a, - 0x0a, 0x83, 0xa6, 0x6f, 0x22, 0xc8, 0x6b, 0x97, 0x75, 0xd0, 0xc0, 0x32, 0x8d, 0xf4, 0xa9, 0x81, - 0x16, 0xf0, 0x56, 0x71, 0xd0, 0xa3, 0xfb, 0x6f, 0x22, 0xc8, 0xa9, 0x94, 0x35, 0x5d, 0x6f, 0x98, - 0x0b, 0xf4, 0x12, 0xfa, 0xb9, 0x09, 0x5f, 0x37, 0x3c, 0xaa, 0x9a, 0x51, 0x37, 0x3c, 0xea, 0x64, - 0x62, 0x03, 0x9d, 0xc3, 0xb0, 0x30, 0xf3, 0xd1, 0xbd, 0x55, 0x9e, 0x45, 0x25, 0xb1, 0xee, 0xaf, - 0xb5, 0x4b, 0x63, 0x9c, 0x6f, 0xc9, 0xff, 0x4d, 0x8f, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x5d, - 0xf3, 0x60, 0x76, 0x4e, 0x0d, 0x00, 0x00, + // 1044 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x57, 0xdd, 0x72, 0xdb, 0x44, + 0x14, 0x8e, 0x6a, 0x3b, 0x76, 0x8e, 0x6d, 0x6a, 0xd6, 0x69, 0xa2, 0xaa, 0x10, 0x8c, 0x80, 0xd4, + 0x69, 0x43, 0x80, 0x74, 0x80, 0x32, 0xdc, 0x00, 0x09, 0x30, 0xb9, 0xe8, 0x94, 0xd9, 0x4c, 0x3b, + 0xcc, 0xd0, 0x19, 0x8f, 0x22, 0xad, 0x9d, 0x25, 0xb2, 0xe4, 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0x1a, 0x57, 0x2b, 0xa6, + 0x1c, 0xbd, 0x82, 0x6e, 0x8a, 0x2d, 0xca, 0x86, 0x47, 0x91, 0x7f, 0xca, 0x86, 0x47, 0x19, 0xe5, + 0x6c, 0xa0, 0x0b, 0xe8, 0x67, 0xf8, 0x03, 0xed, 0xaf, 0xb3, 0xcc, 0xb2, 0x92, 0xf5, 0xb0, 0x52, + 0x2f, 0xdd, 0x64, 0x69, 0x5a, 0x41, 0x6b, 0x83, 0xcb, 0x0e, 0xc0, 0xfd, 0x2a, 0xb5, 0xc4, 0xc1, + 0xc5, 0xa6, 0xfc, 0xc9, 0x7b, 0xf2, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x3c, 0x6d, 0xd7, + 0xfb, 0x0d, 0x00, 0x00, } diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go index f0b57b35a..429ca9b68 100644 --- a/weed/server/volume_grpc_admin.go +++ b/weed/server/volume_grpc_admin.go @@ -78,3 +78,19 @@ func (vs *VolumeServer) VolumeUnmount(ctx context.Context, req *volume_server_pb return resp, err } + +func (vs *VolumeServer) VolumeDelete(ctx context.Context, req *volume_server_pb.VolumeDeleteRequest) (*volume_server_pb.VolumeDeleteResponse, error) { + + resp := &volume_server_pb.VolumeDeleteResponse{} + + err := vs.store.DeleteVolume(storage.VolumeId(req.VolumdId)) + + if err != nil { + glog.Errorf("volume delete %v: %v", req, err) + } else { + glog.V(2).Infof("volume delete %v", req) + } + + return resp, err + +} diff --git a/weed/storage/store.go b/weed/storage/store.go index 5b6270b6b..8c0299545 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -254,3 +254,15 @@ func (s *Store) UnmountVolume(i VolumeId) error { return fmt.Errorf("Volume %d not found on disk", i) } + +func (s *Store) DeleteVolume(i VolumeId) error { + for _, location := range s.Locations { + if error := location.deleteVolumeById(i); error == nil { + s.DeletedVolumeIdChan <- VolumeId(i) + return nil + } + } + + return fmt.Errorf("Volume %d not found on disk", i) +} +