aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-11-23 00:24:51 -0800
committerChris Lu <chris.lu@gmail.com>2018-11-23 00:24:51 -0800
commit444dfded84696eb2d67876e228939ca3f9e7819f (patch)
tree6a026fca7ac363c7f76fab963603733208ed1f12
parent2e32b44061e10d599faf6180d3f5bcffb16a12bb (diff)
downloadseaweedfs-444dfded84696eb2d67876e228939ca3f9e7819f.tar.xz
seaweedfs-444dfded84696eb2d67876e228939ca3f9e7819f.zip
add fs.FSStatfser for SeaweedFS weed mount
-rw-r--r--weed/filesys/wfs.go43
-rw-r--r--weed/operation/stats.go24
-rw-r--r--weed/pb/filer.proto17
-rw-r--r--weed/pb/filer_pb/filer.pb.go275
-rw-r--r--weed/pb/master.proto16
-rw-r--r--weed/pb/master_pb/master.pb.go254
-rw-r--r--weed/server/filer_grpc_server.go25
-rw-r--r--weed/server/master_grpc_server_volume.go26
-rw-r--r--weed/topology/volume_layout.go29
-rw-r--r--weed/topology/volume_location_list.go14
10 files changed, 584 insertions, 139 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index ff482edb5..e1f369e5b 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -43,6 +43,12 @@ type WFS struct {
// cache grpc connections
grpcClients map[string]*grpc.ClientConn
grpcClientsLock sync.Mutex
+
+ stats statsCache
+}
+type statsCache struct {
+ filer_pb.StatisticsResponse
+ lastChecked int64 // unix time in seconds
}
func NewSeaweedFileSystem(option *Option) *WFS {
@@ -139,9 +145,40 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.
glog.V(4).Infof("reading fs stats: %+v", req)
- totalDiskSize := uint64(0)
- usedDiskSize := uint64(0)
- actualFileCount := uint64(0)
+ if wfs.stats.lastChecked < time.Now().Unix()-20 {
+
+ err := wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
+
+ request := &filer_pb.StatisticsRequest{
+ Collection: wfs.option.Collection,
+ Replication: wfs.option.Replication,
+ Ttl: fmt.Sprintf("%ds", wfs.option.TtlSec),
+ }
+
+ glog.V(4).Infof("reading filer stats: %+v", request)
+ resp, err := client.Statistics(ctx, request)
+ if err != nil {
+ glog.V(0).Infof("reading filer stats %v: %v", request, err)
+ return err
+ }
+ glog.V(4).Infof("read filer stats: %+v", resp)
+
+ wfs.stats.TotalSize = resp.TotalSize
+ wfs.stats.UsedSize = resp.UsedSize
+ wfs.stats.FileCount = resp.FileCount
+ wfs.stats.lastChecked = time.Now().Unix()
+
+ return nil
+ })
+ if err != nil {
+ glog.V(0).Infof("filer Statistics: %v", err)
+ return err
+ }
+ }
+
+ totalDiskSize := wfs.stats.TotalSize
+ usedDiskSize := wfs.stats.UsedSize
+ actualFileCount := wfs.stats.FileCount
// Compute the total number of available blocks
resp.Blocks = totalDiskSize / blockSize
diff --git a/weed/operation/stats.go b/weed/operation/stats.go
new file mode 100644
index 000000000..277b0e835
--- /dev/null
+++ b/weed/operation/stats.go
@@ -0,0 +1,24 @@
+package operation
+
+import (
+ "context"
+
+ "github.com/chrislusf/seaweedfs/weed/pb/master_pb"
+)
+
+func Statistics(server string, req *master_pb.StatisticsRequest) (resp *master_pb.StatisticsResponse, err error) {
+
+ err = withMasterServerClient(server, func(masterClient master_pb.SeaweedClient) error {
+ grpcResponse, grpcErr := masterClient.Statistics(context.Background(), req)
+ if grpcErr != nil {
+ return grpcErr
+ }
+
+ resp = grpcResponse
+
+ return nil
+
+ })
+
+ return
+}
diff --git a/weed/pb/filer.proto b/weed/pb/filer.proto
index 3f7c39c89..a19aa7dbc 100644
--- a/weed/pb/filer.proto
+++ b/weed/pb/filer.proto
@@ -30,6 +30,9 @@ service SeaweedFiler {
rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
}
+ rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
+ }
+
}
//////////////////////////////////////////////////
@@ -154,3 +157,17 @@ message DeleteCollectionRequest {
message DeleteCollectionResponse {
}
+
+message StatisticsRequest {
+ string replication = 1;
+ string collection = 2;
+ string ttl = 3;
+}
+message StatisticsResponse {
+ string replication = 1;
+ string collection = 2;
+ string ttl = 3;
+ uint64 total_size = 4;
+ uint64 used_size = 5;
+ uint64 file_count = 6;
+}
diff --git a/weed/pb/filer_pb/filer.pb.go b/weed/pb/filer_pb/filer.pb.go
index f4b5355ea..f9e4d9858 100644
--- a/weed/pb/filer_pb/filer.pb.go
+++ b/weed/pb/filer_pb/filer.pb.go
@@ -31,6 +31,8 @@ It has these top-level messages:
LookupVolumeResponse
DeleteCollectionRequest
DeleteCollectionResponse
+ StatisticsRequest
+ StatisticsResponse
*/
package filer_pb
@@ -686,6 +688,94 @@ func (m *DeleteCollectionResponse) String() string { return proto.Com
func (*DeleteCollectionResponse) ProtoMessage() {}
func (*DeleteCollectionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
+type StatisticsRequest struct {
+ Replication string `protobuf:"bytes,1,opt,name=replication" json:"replication,omitempty"`
+ Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
+ Ttl string `protobuf:"bytes,3,opt,name=ttl" json:"ttl,omitempty"`
+}
+
+func (m *StatisticsRequest) Reset() { *m = StatisticsRequest{} }
+func (m *StatisticsRequest) String() string { return proto.CompactTextString(m) }
+func (*StatisticsRequest) ProtoMessage() {}
+func (*StatisticsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
+
+func (m *StatisticsRequest) GetReplication() string {
+ if m != nil {
+ return m.Replication
+ }
+ return ""
+}
+
+func (m *StatisticsRequest) GetCollection() string {
+ if m != nil {
+ return m.Collection
+ }
+ return ""
+}
+
+func (m *StatisticsRequest) GetTtl() string {
+ if m != nil {
+ return m.Ttl
+ }
+ return ""
+}
+
+type StatisticsResponse struct {
+ Replication string `protobuf:"bytes,1,opt,name=replication" json:"replication,omitempty"`
+ Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
+ Ttl string `protobuf:"bytes,3,opt,name=ttl" json:"ttl,omitempty"`
+ TotalSize uint64 `protobuf:"varint,4,opt,name=total_size,json=totalSize" json:"total_size,omitempty"`
+ UsedSize uint64 `protobuf:"varint,5,opt,name=used_size,json=usedSize" json:"used_size,omitempty"`
+ FileCount uint64 `protobuf:"varint,6,opt,name=file_count,json=fileCount" json:"file_count,omitempty"`
+}
+
+func (m *StatisticsResponse) Reset() { *m = StatisticsResponse{} }
+func (m *StatisticsResponse) String() string { return proto.CompactTextString(m) }
+func (*StatisticsResponse) ProtoMessage() {}
+func (*StatisticsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
+
+func (m *StatisticsResponse) GetReplication() string {
+ if m != nil {
+ return m.Replication
+ }
+ return ""
+}
+
+func (m *StatisticsResponse) GetCollection() string {
+ if m != nil {
+ return m.Collection
+ }
+ return ""
+}
+
+func (m *StatisticsResponse) GetTtl() string {
+ if m != nil {
+ return m.Ttl
+ }
+ return ""
+}
+
+func (m *StatisticsResponse) GetTotalSize() uint64 {
+ if m != nil {
+ return m.TotalSize
+ }
+ return 0
+}
+
+func (m *StatisticsResponse) GetUsedSize() uint64 {
+ if m != nil {
+ return m.UsedSize
+ }
+ return 0
+}
+
+func (m *StatisticsResponse) GetFileCount() uint64 {
+ if m != nil {
+ return m.FileCount
+ }
+ return 0
+}
+
func init() {
proto.RegisterType((*LookupDirectoryEntryRequest)(nil), "filer_pb.LookupDirectoryEntryRequest")
proto.RegisterType((*LookupDirectoryEntryResponse)(nil), "filer_pb.LookupDirectoryEntryResponse")
@@ -709,6 +799,8 @@ func init() {
proto.RegisterType((*LookupVolumeResponse)(nil), "filer_pb.LookupVolumeResponse")
proto.RegisterType((*DeleteCollectionRequest)(nil), "filer_pb.DeleteCollectionRequest")
proto.RegisterType((*DeleteCollectionResponse)(nil), "filer_pb.DeleteCollectionResponse")
+ proto.RegisterType((*StatisticsRequest)(nil), "filer_pb.StatisticsRequest")
+ proto.RegisterType((*StatisticsResponse)(nil), "filer_pb.StatisticsResponse")
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -730,6 +822,7 @@ type SeaweedFilerClient interface {
AssignVolume(ctx context.Context, in *AssignVolumeRequest, opts ...grpc.CallOption) (*AssignVolumeResponse, error)
LookupVolume(ctx context.Context, in *LookupVolumeRequest, opts ...grpc.CallOption) (*LookupVolumeResponse, error)
DeleteCollection(ctx context.Context, in *DeleteCollectionRequest, opts ...grpc.CallOption) (*DeleteCollectionResponse, error)
+ Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsResponse, error)
}
type seaweedFilerClient struct {
@@ -812,6 +905,15 @@ func (c *seaweedFilerClient) DeleteCollection(ctx context.Context, in *DeleteCol
return out, nil
}
+func (c *seaweedFilerClient) Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsResponse, error) {
+ out := new(StatisticsResponse)
+ err := grpc.Invoke(ctx, "/filer_pb.SeaweedFiler/Statistics", in, out, c.cc, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// Server API for SeaweedFiler service
type SeaweedFilerServer interface {
@@ -823,6 +925,7 @@ type SeaweedFilerServer interface {
AssignVolume(context.Context, *AssignVolumeRequest) (*AssignVolumeResponse, error)
LookupVolume(context.Context, *LookupVolumeRequest) (*LookupVolumeResponse, error)
DeleteCollection(context.Context, *DeleteCollectionRequest) (*DeleteCollectionResponse, error)
+ Statistics(context.Context, *StatisticsRequest) (*StatisticsResponse, error)
}
func RegisterSeaweedFilerServer(s *grpc.Server, srv SeaweedFilerServer) {
@@ -973,6 +1076,24 @@ func _SeaweedFiler_DeleteCollection_Handler(srv interface{}, ctx context.Context
return interceptor(ctx, in, info, handler)
}
+func _SeaweedFiler_Statistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(StatisticsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(SeaweedFilerServer).Statistics(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/filer_pb.SeaweedFiler/Statistics",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(SeaweedFilerServer).Statistics(ctx, req.(*StatisticsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
ServiceName: "filer_pb.SeaweedFiler",
HandlerType: (*SeaweedFilerServer)(nil),
@@ -1009,6 +1130,10 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
MethodName: "DeleteCollection",
Handler: _SeaweedFiler_DeleteCollection_Handler,
},
+ {
+ MethodName: "Statistics",
+ Handler: _SeaweedFiler_Statistics_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "filer.proto",
@@ -1017,76 +1142,82 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("filer.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 1129 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x57, 0x4d, 0x6f, 0xdc, 0xc4,
- 0x1b, 0x8f, 0xf7, 0x2d, 0xeb, 0x67, 0x77, 0xf3, 0x6f, 0x66, 0xf3, 0xa7, 0xd6, 0x36, 0x29, 0x5b,
- 0xd3, 0xa2, 0x54, 0x44, 0x51, 0x15, 0x38, 0xb4, 0x54, 0x48, 0x54, 0x79, 0x91, 0x2a, 0xa5, 0xad,
- 0xe4, 0x34, 0x48, 0x88, 0x83, 0xe5, 0xd8, 0x4f, 0xc2, 0x28, 0x5e, 0x7b, 0xf1, 0x8c, 0x93, 0x96,
- 0xaf, 0xc0, 0x95, 0x2b, 0x07, 0x4e, 0xdc, 0x38, 0xf0, 0x01, 0xb8, 0xf0, 0xc5, 0xd0, 0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0x63,
+ 0x78, 0x98, 0xd6, 0xaa, 0xe3, 0xca, 0xb4, 0x56, 0x37, 0x71, 0xa4, 0x35, 0x63, 0x30, 0x98, 0xd6,
+ 0xaa, 0xa3, 0xc8, 0xb4, 0x56, 0x37, 0x4d, 0xa4, 0x35, 0xa3, 0x35, 0x9b, 0xd6, 0xaa, 0x53, 0xc6,
+ 0xb4, 0x56, 0xd7, 0xcf, 0xef, 0x90, 0xd7, 0xd0, 0x37, 0xfb, 0x24, 0x31, 0x0e, 0xd4, 0x34, 0xfa,
+ 0xf1, 0xfd, 0x9b, 0xc4, 0xa6, 0x41, 0xb3, 0x2d, 0x98, 0x06, 0x6b, 0x1a, 0xa3, 0x69, 0xb0, 0xae,
+ 0x9b, 0x38, 0x77, 0xc8, 0x77, 0xb0, 0xba, 0xfc, 0x3c, 0xc9, 0x83, 0xe5, 0xb4, 0x2a, 0xaf, 0x7e,
+ 0xec, 0xdc, 0xa6, 0x52, 0x18, 0x3f, 0x06, 0x58, 0xbc, 0x3a, 0xb2, 0xb1, 0x38, 0x53, 0x79, 0xf5,
+ 0xe3, 0xcd, 0x7a, 0x61, 0x6e, 0xea, 0xbc, 0x23, 0x7f, 0xf0, 0x3e, 0xff, 0x3b, 0x00, 0x00, 0xff,
+ 0xff, 0xd6, 0x35, 0x68, 0xc8, 0xef, 0x0d, 0x00, 0x00,
}
diff --git a/weed/pb/master.proto b/weed/pb/master.proto
index c1e5d4798..544160c06 100644
--- a/weed/pb/master.proto
+++ b/weed/pb/master.proto
@@ -13,6 +13,8 @@ service Seaweed {
}
rpc Assign (AssignRequest) returns (AssignResponse) {
}
+ rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
+ }
}
//////////////////////////////////////////////////
@@ -108,3 +110,17 @@ message AssignResponse {
uint64 count = 4;
string error = 5;
}
+
+message StatisticsRequest {
+ string replication = 1;
+ string collection = 2;
+ string ttl = 3;
+}
+message StatisticsResponse {
+ string replication = 1;
+ string collection = 2;
+ string ttl = 3;
+ uint64 total_size = 4;
+ uint64 used_size = 5;
+ uint64 file_count = 6;
+}
diff --git a/weed/pb/master_pb/master.pb.go b/weed/pb/master_pb/master.pb.go
index 79d4d3f53..894f08471 100644
--- a/weed/pb/master_pb/master.pb.go
+++ b/weed/pb/master_pb/master.pb.go
@@ -21,6 +21,8 @@ It has these top-level messages:
Location
AssignRequest
AssignResponse
+ StatisticsRequest
+ StatisticsResponse
*/
package master_pb
@@ -585,6 +587,94 @@ func (m *AssignResponse) GetError() string {
return ""
}
+type StatisticsRequest struct {
+ Replication string `protobuf:"bytes,1,opt,name=replication" json:"replication,omitempty"`
+ Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
+ Ttl string `protobuf:"bytes,3,opt,name=ttl" json:"ttl,omitempty"`
+}
+
+func (m *StatisticsRequest) Reset() { *m = StatisticsRequest{} }
+func (m *StatisticsRequest) String() string { return proto.CompactTextString(m) }
+func (*StatisticsRequest) ProtoMessage() {}
+func (*StatisticsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
+
+func (m *StatisticsRequest) GetReplication() string {
+ if m != nil {
+ return m.Replication
+ }
+ return ""
+}
+
+func (m *StatisticsRequest) GetCollection() string {
+ if m != nil {
+ return m.Collection
+ }
+ return ""
+}
+
+func (m *StatisticsRequest) GetTtl() string {
+ if m != nil {
+ return m.Ttl
+ }
+ return ""
+}
+
+type StatisticsResponse struct {
+ Replication string `protobuf:"bytes,1,opt,name=replication" json:"replication,omitempty"`
+ Collection string `protobuf:"bytes,2,opt,name=collection" json:"collection,omitempty"`
+ Ttl string `protobuf:"bytes,3,opt,name=ttl" json:"ttl,omitempty"`
+ TotalSize uint64 `protobuf:"varint,4,opt,name=total_size,json=totalSize" json:"total_size,omitempty"`
+ UsedSize uint64 `protobuf:"varint,5,opt,name=used_size,json=usedSize" json:"used_size,omitempty"`
+ FileCount uint64 `protobuf:"varint,6,opt,name=file_count,json=fileCount" json:"file_count,omitempty"`
+}
+
+func (m *StatisticsResponse) Reset() { *m = StatisticsResponse{} }
+func (m *StatisticsResponse) String() string { return proto.CompactTextString(m) }
+func (*StatisticsResponse) ProtoMessage() {}
+func (*StatisticsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
+
+func (m *StatisticsResponse) GetReplication() string {
+ if m != nil {
+ return m.Replication
+ }
+ return ""
+}
+
+func (m *StatisticsResponse) GetCollection() string {
+ if m != nil {
+ return m.Collection
+ }
+ return ""
+}
+
+func (m *StatisticsResponse) GetTtl() string {
+ if m != nil {
+ return m.Ttl
+ }
+ return ""
+}
+
+func (m *StatisticsResponse) GetTotalSize() uint64 {
+ if m != nil {
+ return m.TotalSize
+ }
+ return 0
+}
+
+func (m *StatisticsResponse) GetUsedSize() uint64 {
+ if m != nil {
+ return m.UsedSize
+ }
+ return 0
+}
+
+func (m *StatisticsResponse) GetFileCount() uint64 {
+ if m != nil {
+ return m.FileCount
+ }
+ return 0
+}
+
func init() {
proto.RegisterType((*Heartbeat)(nil), "master_pb.Heartbeat")
proto.RegisterType((*HeartbeatResponse)(nil), "master_pb.HeartbeatResponse")
@@ -600,6 +690,8 @@ func init() {
proto.RegisterType((*Location)(nil), "master_pb.Location")
proto.RegisterType((*AssignRequest)(nil), "master_pb.AssignRequest")
proto.RegisterType((*AssignResponse)(nil), "master_pb.AssignResponse")
+ proto.RegisterType((*StatisticsRequest)(nil), "master_pb.StatisticsRequest")
+ proto.RegisterType((*StatisticsResponse)(nil), "master_pb.StatisticsResponse")
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -617,6 +709,7 @@ type SeaweedClient interface {
KeepConnected(ctx context.Context, opts ...grpc.CallOption) (Seaweed_KeepConnectedClient, error)
LookupVolume(ctx context.Context, in *LookupVolumeRequest, opts ...grpc.CallOption) (*LookupVolumeResponse, error)
Assign(ctx context.Context, in *AssignRequest, opts ...grpc.CallOption) (*AssignResponse, error)
+ Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsResponse, error)
}
type seaweedClient struct {
@@ -707,6 +800,15 @@ func (c *seaweedClient) Assign(ctx context.Context, in *AssignRequest, opts ...g
return out, nil
}
+func (c *seaweedClient) Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsResponse, error) {
+ out := new(StatisticsResponse)
+ err := grpc.Invoke(ctx, "/master_pb.Seaweed/Statistics", in, out, c.cc, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// Server API for Seaweed service
type SeaweedServer interface {
@@ -714,6 +816,7 @@ type SeaweedServer interface {
KeepConnected(Seaweed_KeepConnectedServer) error
LookupVolume(context.Context, *LookupVolumeRequest) (*LookupVolumeResponse, error)
Assign(context.Context, *AssignRequest) (*AssignResponse, error)
+ Statistics(context.Context, *StatisticsRequest) (*StatisticsResponse, error)
}
func RegisterSeaweedServer(s *grpc.Server, srv SeaweedServer) {
@@ -808,6 +911,24 @@ func _Seaweed_Assign_Handler(srv interface{}, ctx context.Context, dec func(inte
return interceptor(ctx, in, info, handler)
}
+func _Seaweed_Statistics_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(StatisticsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(SeaweedServer).Statistics(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/master_pb.Seaweed/Statistics",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(SeaweedServer).Statistics(ctx, req.(*StatisticsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
var _Seaweed_serviceDesc = grpc.ServiceDesc{
ServiceName: "master_pb.Seaweed",
HandlerType: (*SeaweedServer)(nil),
@@ -820,6 +941,10 @@ var _Seaweed_serviceDesc = grpc.ServiceDesc{
MethodName: "Assign",
Handler: _Seaweed_Assign_Handler,
},
+ {
+ MethodName: "Statistics",
+ Handler: _Seaweed_Statistics_Handler,
+ },
},
Streams: []grpc.StreamDesc{
{
@@ -841,66 +966,71 @@ var _Seaweed_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("master.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
- // 971 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6e, 0x23, 0x45,
- 0x17, 0x4d, 0xb7, 0x7f, 0xfb, 0x3a, 0xce, 0x38, 0x95, 0xe8, 0x53, 0x8f, 0x67, 0xbe, 0x19, 0xd3,
- 0x6c, 0x8c, 0x40, 0xd1, 0x10, 0x96, 0x08, 0x21, 0xc6, 0x0a, 0x22, 0x4a, 0x60, 0x42, 0x07, 0x66,
- 0xc1, 0xa6, 0x29, 0x77, 0xdf, 0x44, 0xa5, 0xf4, 0x1f, 0x55, 0xe5, 0xc4, 0x9e, 0x0d, 0xef, 0xc5,
- 0x82, 0x15, 0x3b, 0x1e, 0x85, 0x1d, 0x4f, 0x80, 0xea, 0xa7, 0xdb, 0x6d, 0x27, 0x61, 0x24, 0x76,
- 0x55, 0xa7, 0xef, 0xad, 0x3a, 0x75, 0xce, 0xbd, 0x55, 0x0d, 0xbb, 0x19, 0x15, 0x12, 0xf9, 0x51,
- 0xc9, 0x0b, 0x59, 0x10, 0xcf, 0xcc, 0xa2, 0x72, 0x1e, 0xfc, 0xe5, 0x82, 0xf7, 0x0d, 0x52, 0x2e,
- 0xe7, 0x48, 0x25, 0xd9, 0x03, 0x97, 0x95, 0xbe, 0x33, 0x71, 0xa6, 0x5e, 0xe8, 0xb2, 0x92, 0x10,
- 0x68, 0x97, 0x05, 0x97, 0xbe, 0x3b, 0x71, 0xa6, 0xc3, 0x50, 0x8f, 0xc9, 0xff, 0x01, 0xca, 0xc5,
- 0x3c, 0x65, 0x71, 0xb4, 0xe0, 0xa9, 0xdf, 0xd2, 0xb1, 0x9e, 0x41, 0x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+ 0x7c, 0xe3, 0x5f, 0xa1, 0xaa, 0x28, 0x7b, 0xe3, 0x77, 0xf0, 0xb0, 0xd9, 0x19, 0x36, 0x2e, 0xbc,
+ 0xa5, 0x8f, 0x4d, 0x5f, 0xdc, 0xd3, 0x52, 0x82, 0x07, 0xe4, 0x0b, 0xe8, 0x9b, 0x5c, 0x25, 0x7e,
+ 0xc3, 0x78, 0xa3, 0x16, 0x37, 0xe2, 0xda, 0x4c, 0xec, 0xe0, 0x01, 0x39, 0x02, 0x58, 0x67, 0x00,
+ 0x69, 0xf2, 0x72, 0x23, 0x05, 0xa7, 0xcf, 0xee, 0xd8, 0xad, 0x2e, 0x3b, 0xeb, 0xeb, 0x3f, 0xc8,
+ 0x4f, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc7, 0x9f, 0x0a, 0x25, 0x51, 0x0a, 0x00, 0x00,
}
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go
index 72d5b2e1d..3993bcf07 100644
--- a/weed/server/filer_grpc_server.go
+++ b/weed/server/filer_grpc_server.go
@@ -5,6 +5,8 @@ import (
"fmt"
"os"
"path/filepath"
+ "strconv"
+ "strings"
"time"
"github.com/chrislusf/seaweedfs/weed/filer2"
@@ -12,8 +14,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/util"
- "strconv"
- "strings"
+ "github.com/chrislusf/seaweedfs/weed/pb/master_pb"
)
func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) {
@@ -233,3 +234,23 @@ func (fs *FilerServer) DeleteCollection(ctx context.Context, req *filer_pb.Delet
return &filer_pb.DeleteCollectionResponse{}, err
}
+
+func (fs *FilerServer) Statistics(ctx context.Context, req *filer_pb.StatisticsRequest) (resp *filer_pb.StatisticsResponse, err error) {
+
+ input := &master_pb.StatisticsRequest{
+ Replication: req.Replication,
+ Collection: req.Collection,
+ Ttl: req.Ttl,
+ }
+
+ output, err := operation.Statistics(fs.filer.GetMaster(), input)
+ if err != nil {
+ return nil, err
+ }
+
+ return &filer_pb.StatisticsResponse{
+ TotalSize: output.TotalSize,
+ UsedSize: output.UsedSize,
+ FileCount: output.FileCount,
+ }, nil
+}
diff --git a/weed/server/master_grpc_server_volume.go b/weed/server/master_grpc_server_volume.go
index 26dec1577..76d659009 100644
--- a/weed/server/master_grpc_server_volume.go
+++ b/weed/server/master_grpc_server_volume.go
@@ -84,3 +84,29 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest
Count: count,
}, nil
}
+
+func (ms *MasterServer) Statistics(ctx context.Context, req *master_pb.StatisticsRequest) (*master_pb.StatisticsResponse, error) {
+
+ if req.Replication == "" {
+ req.Replication = ms.defaultReplicaPlacement
+ }
+ replicaPlacement, err := storage.NewReplicaPlacementFromString(req.Replication)
+ if err != nil {
+ return nil, err
+ }
+ ttl, err := storage.ReadTTL(req.Ttl)
+ if err != nil {
+ return nil, err
+ }
+
+ volumeLayout := ms.Topo.GetVolumeLayout(req.Collection, replicaPlacement, ttl)
+ stats := volumeLayout.Stats()
+
+ resp := &master_pb.StatisticsResponse{
+ TotalSize: stats.TotalSize,
+ UsedSize: stats.UsedSize,
+ FileCount: stats.FileCount,
+ }
+
+ return resp, nil
+}
diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go
index 8c0a75140..b6044e29f 100644
--- a/weed/topology/volume_layout.go
+++ b/weed/topology/volume_layout.go
@@ -5,6 +5,7 @@ import (
"fmt"
"math/rand"
"sync"
+ "time"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/storage"
@@ -22,6 +23,12 @@ type VolumeLayout struct {
accessLock sync.RWMutex
}
+type VolumeLayoutStats struct {
+ TotalSize uint64
+ UsedSize uint64
+ FileCount uint64
+}
+
func NewVolumeLayout(rp *storage.ReplicaPlacement, ttl *storage.TTL, volumeSizeLimit uint64) *VolumeLayout {
return &VolumeLayout{
rp: rp,
@@ -265,3 +272,25 @@ func (vl *VolumeLayout) ToMap() map[string]interface{} {
//m["locations"] = vl.vid2location
return m
}
+
+func (vl *VolumeLayout) Stats() *VolumeLayoutStats {
+ vl.accessLock.RLock()
+ defer vl.accessLock.RUnlock()
+
+ ret := &VolumeLayoutStats{}
+
+ freshThreshold := time.Now().Unix() - 60
+
+ for vid, vll := range vl.vid2location {
+ size, fileCount := vll.Stats(vid, freshThreshold)
+ ret.FileCount += uint64(fileCount)
+ ret.UsedSize += size
+ if vl.readonlyVolumes[vid] {
+ ret.TotalSize += size
+ } else {
+ ret.TotalSize += vl.volumeSizeLimit
+ }
+ }
+
+ return ret
+}
diff --git a/weed/topology/volume_location_list.go b/weed/topology/volume_location_list.go
index d5eaf5e92..8d5881333 100644
--- a/weed/topology/volume_location_list.go
+++ b/weed/topology/volume_location_list.go
@@ -2,6 +2,8 @@ package topology
import (
"fmt"
+
+ "github.com/chrislusf/seaweedfs/weed/storage"
)
type VolumeLocationList struct {
@@ -63,3 +65,15 @@ func (dnll *VolumeLocationList) Refresh(freshThreshHold int64) {
dnll.list = l
}
}
+
+func (dnll *VolumeLocationList) Stats(vid storage.VolumeId, freshThreshHold int64) (size uint64, fileCount int) {
+ for _, dnl := range dnll.list {
+ if dnl.LastSeen < freshThreshHold {
+ vinfo, err := dnl.GetVolumesById(vid)
+ if err == nil {
+ return vinfo.Size - vinfo.DeletedByteCount, vinfo.FileCount - vinfo.DeleteCount
+ }
+ }
+ }
+ return 0, 0
+}