From cbd0a98fa12c20f5ace09bda44d2d2700d8dc74e Mon Sep 17 00:00:00 2001 From: "j.laycock" Date: Tue, 3 Sep 2019 18:19:02 +0100 Subject: [PATCH] Add InMemory to Volume Grow structure --- weed/pb/volume_server_pb/volume_server.pb.go | 8 -------- weed/server/volume_grpc_admin.go | 2 +- weed/storage/store.go | 4 ++-- weed/topology/allocate_volume.go | 1 + weed/topology/volume_growth.go | 1 + 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/weed/pb/volume_server_pb/volume_server.pb.go b/weed/pb/volume_server_pb/volume_server.pb.go index 02aa78989..897ad7fbb 100644 --- a/weed/pb/volume_server_pb/volume_server.pb.go +++ b/weed/pb/volume_server_pb/volume_server.pb.go @@ -214,7 +214,6 @@ func (m *VacuumVolumeCheckResponse) GetGarbageRatio() float64 { type VacuumVolumeCompactRequest struct { VolumeId uint32 `protobuf:"varint,1,opt,name=volume_id,json=volumeId" json:"volume_id,omitempty"` Preallocate int64 `protobuf:"varint,2,opt,name=preallocate" json:"preallocate,omitempty"` - InMemory bool `protobuf:"varint,2,opt,name=inmemory" json:"inmemory,omitempty"` } func (m *VacuumVolumeCompactRequest) Reset() { *m = VacuumVolumeCompactRequest{} } @@ -236,13 +235,6 @@ func (m *VacuumVolumeCompactRequest) GetPreallocate() int64 { return 0 } -func (m *VacuumVolumeCompactRequest) GetInMemory() bool { - if m != nil { - return m.InMemory - } - return false -} - type VacuumVolumeCompactResponse struct { } diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go index 93d8c4709..f52f9fd2d 100644 --- a/weed/server/volume_grpc_admin.go +++ b/weed/server/volume_grpc_admin.go @@ -35,7 +35,7 @@ func (vs *VolumeServer) AllocateVolume(ctx context.Context, req *volume_server_p req.Replication, req.Ttl, req.Preallocate, - req.GetInMemory(), + req.InMemory, ) if err != nil { diff --git a/weed/storage/store.go b/weed/storage/store.go index 5f55db31e..89b92f229 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -59,7 +59,7 @@ func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, di return } -func (s *Store) AddVolume(volumeId needle.VolumeId, collection string, needleMapKind NeedleMapType, replicaPlacement string, ttlString string, preallocate int64, in_memory bool) error { +func (s *Store) AddVolume(volumeId needle.VolumeId, collection string, needleMapKind NeedleMapType, replicaPlacement string, ttlString string, preallocate int64, memoryMapped bool) error { rt, e := NewReplicaPlacementFromString(replicaPlacement) if e != nil { return e @@ -68,7 +68,7 @@ func (s *Store) AddVolume(volumeId needle.VolumeId, collection string, needleMap if e != nil { return e } - e = s.addVolume(volumeId, collection, needleMapKind, rt, ttl, preallocate, in_memory) + e = s.addVolume(volumeId, collection, needleMapKind, rt, ttl, preallocate, memoryMapped) return e } func (s *Store) DeleteCollection(collection string) (e error) { diff --git a/weed/topology/allocate_volume.go b/weed/topology/allocate_volume.go index 69d106964..91a67681a 100644 --- a/weed/topology/allocate_volume.go +++ b/weed/topology/allocate_volume.go @@ -23,6 +23,7 @@ func AllocateVolume(dn *DataNode, grpcDialOption grpc.DialOption, vid needle.Vol Replication: option.ReplicaPlacement.String(), Ttl: option.Ttl.String(), Preallocate: option.Prealloacte, + InMemory: option.InMemory, }) return deleteErr }) diff --git a/weed/topology/volume_growth.go b/weed/topology/volume_growth.go index adbdd6b27..b9b2b69f7 100644 --- a/weed/topology/volume_growth.go +++ b/weed/topology/volume_growth.go @@ -28,6 +28,7 @@ type VolumeGrowOption struct { DataCenter string Rack string DataNode string + InMemory bool } type VolumeGrowth struct {