mirror of https://github.com/etcd-io/dbtester.git
*: record datasize and save to CSV
This commit is contained in:
parent
3ad85a2ce0
commit
1b2962c6d0
|
|
@ -136,6 +136,9 @@ func (*Request) Descriptor() ([]byte, []int) { return fileDescriptorMessage, []i
|
|||
|
||||
type Response struct {
|
||||
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
||||
// DataSize is the data size of the database on disk.
|
||||
// It measures after database is requested to stop.
|
||||
DataSize int64 `protobuf:"varint,2,opt,name=dataSize,proto3" json:"dataSize,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Response) Reset() { *m = Response{} }
|
||||
|
|
@ -346,6 +349,11 @@ func (m *Response) MarshalTo(dAtA []byte) (int, error) {
|
|||
}
|
||||
i++
|
||||
}
|
||||
if m.DataSize != 0 {
|
||||
dAtA[i] = 0x10
|
||||
i++
|
||||
i = encodeVarintMessage(dAtA, i, uint64(m.DataSize))
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
|
|
@ -439,6 +447,9 @@ func (m *Response) Size() (n int) {
|
|||
if m.Success {
|
||||
n += 2
|
||||
}
|
||||
if m.DataSize != 0 {
|
||||
n += 1 + sovMessage(uint64(m.DataSize))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
|
|
@ -899,6 +910,25 @@ func (m *Response) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
}
|
||||
m.Success = bool(v != 0)
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field DataSize", wireType)
|
||||
}
|
||||
m.DataSize = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowMessage
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.DataSize |= (int64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipMessage(dAtA[iNdEx:])
|
||||
|
|
@ -1028,41 +1058,42 @@ var (
|
|||
func init() { proto.RegisterFile("agent/agentpb/message.proto", fileDescriptorMessage) }
|
||||
|
||||
var fileDescriptorMessage = []byte{
|
||||
// 566 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x93, 0xcb, 0x6e, 0xd3, 0x40,
|
||||
0x14, 0x86, 0xe3, 0x5e, 0x12, 0xfb, 0xb4, 0x29, 0x66, 0xc4, 0x65, 0x08, 0x95, 0x15, 0x59, 0x5d,
|
||||
0x64, 0x83, 0x23, 0x5a, 0x40, 0x5d, 0xa2, 0xa4, 0x42, 0x54, 0x15, 0xa5, 0xd8, 0xac, 0xd8, 0x8d,
|
||||
0x9d, 0x53, 0x63, 0x9a, 0xcc, 0x98, 0x99, 0x71, 0xd5, 0xf4, 0x49, 0x78, 0xa4, 0x2e, 0x79, 0x84,
|
||||
0x52, 0x5e, 0x04, 0x79, 0x9c, 0xe6, 0x42, 0x5a, 0xd8, 0x44, 0xe7, 0xfc, 0xff, 0xf7, 0x9f, 0x99,
|
||||
0x58, 0x73, 0xe0, 0x39, 0x4b, 0x91, 0xeb, 0xae, 0xf9, 0xcd, 0xe3, 0xee, 0x08, 0x95, 0x62, 0x29,
|
||||
0x06, 0xb9, 0x14, 0x5a, 0x90, 0xc6, 0x44, 0x6e, 0xbd, 0x48, 0x33, 0xfd, 0xb5, 0x88, 0x83, 0x44,
|
||||
0x8c, 0xba, 0xa9, 0x48, 0x45, 0xd7, 0xf8, 0x71, 0x71, 0x6a, 0x3a, 0xd3, 0x98, 0xaa, 0xca, 0xf9,
|
||||
0xd7, 0x75, 0x68, 0x84, 0xf8, 0xbd, 0x40, 0xa5, 0xc9, 0x3e, 0x38, 0x22, 0x47, 0xc9, 0x74, 0x26,
|
||||
0x38, 0xb5, 0xda, 0x56, 0x67, 0x6b, 0xb7, 0x15, 0x4c, 0xe6, 0x06, 0x13, 0x28, 0xf8, 0x78, 0x4b,
|
||||
0x84, 0x33, 0x98, 0xbc, 0x06, 0x7b, 0xc0, 0x34, 0x8b, 0x99, 0x42, 0xba, 0x62, 0x82, 0xcf, 0x96,
|
||||
0x82, 0x07, 0x13, 0x20, 0x9c, 0xa2, 0xc4, 0x87, 0xcd, 0x1c, 0x51, 0x1e, 0x9e, 0x44, 0x5a, 0x66,
|
||||
0x3c, 0xa5, 0xab, 0x6d, 0xab, 0xe3, 0x84, 0x0b, 0x1a, 0x69, 0xc3, 0x86, 0x42, 0x79, 0x8e, 0xf2,
|
||||
0x90, 0x0f, 0xf0, 0x82, 0xae, 0xb5, 0xad, 0x4e, 0x33, 0x9c, 0x97, 0x48, 0x0b, 0x6c, 0x8d, 0x4a,
|
||||
0x1f, 0xb3, 0x11, 0xd2, 0x75, 0x33, 0x61, 0xda, 0x93, 0x37, 0xf0, 0x24, 0x15, 0x22, 0x1d, 0x62,
|
||||
0x7f, 0x28, 0x8a, 0xc1, 0x89, 0x14, 0xdf, 0x30, 0xa9, 0xc8, 0xba, 0x21, 0xef, 0x71, 0xc9, 0x2b,
|
||||
0x78, 0x3c, 0xe7, 0x44, 0x5a, 0x48, 0x96, 0xe2, 0x11, 0x8e, 0x69, 0xc3, 0xc4, 0xee, 0x36, 0x49,
|
||||
0x0f, 0xb6, 0x97, 0x8d, 0x5e, 0x91, 0x9c, 0x61, 0x75, 0xa6, 0x6d, 0xc2, 0xff, 0x64, 0xc8, 0x3b,
|
||||
0xf0, 0x96, 0xfd, 0xa8, 0x88, 0x0f, 0x32, 0x89, 0x89, 0x16, 0x72, 0x4c, 0x1d, 0x33, 0xe5, 0x3f,
|
||||
0x14, 0xd9, 0x81, 0xe6, 0xa5, 0x10, 0x67, 0x88, 0x39, 0xca, 0x0f, 0xe3, 0xc3, 0x03, 0x0a, 0xe6,
|
||||
0xcb, 0x2d, 0x8a, 0x25, 0x85, 0x3a, 0x19, 0x44, 0x9c, 0xe5, 0x7d, 0x51, 0x70, 0x4d, 0x37, 0xda,
|
||||
0x56, 0x67, 0x35, 0x5c, 0x14, 0x49, 0x00, 0xa4, 0x14, 0x3e, 0x15, 0x42, 0xb3, 0x28, 0xbb, 0xc4,
|
||||
0xde, 0x58, 0xa3, 0xa2, 0x9b, 0x06, 0xbd, 0xc3, 0x29, 0xf9, 0xe9, 0x31, 0xb3, 0xd1, 0xcd, 0x8a,
|
||||
0x5f, 0x76, 0xc8, 0x3e, 0x3c, 0x9d, 0x5d, 0x8b, 0x5d, 0xf4, 0x87, 0x19, 0x72, 0xdd, 0xe7, 0x17,
|
||||
0x5c, 0xd1, 0x2d, 0x13, 0xba, 0xcf, 0x26, 0xdb, 0xe0, 0x24, 0xa6, 0x3d, 0x2e, 0x46, 0xf4, 0x81,
|
||||
0x61, 0x67, 0x82, 0xdf, 0x05, 0x67, 0xfa, 0x5c, 0x89, 0x03, 0xeb, 0x91, 0x66, 0x52, 0xbb, 0x35,
|
||||
0x62, 0xc3, 0x5a, 0xa4, 0x45, 0xee, 0x5a, 0xa4, 0x09, 0xce, 0x7b, 0x64, 0x52, 0xc7, 0xc8, 0xb4,
|
||||
0xbb, 0xe2, 0x47, 0x60, 0xdf, 0x3e, 0x53, 0x02, 0x50, 0x2f, 0xff, 0xda, 0xf9, 0xae, 0x5b, 0x9b,
|
||||
0xd6, 0x7b, 0x55, 0xe4, 0x8b, 0x10, 0x47, 0xe6, 0x36, 0xee, 0x4a, 0x69, 0xf5, 0x05, 0x57, 0xc5,
|
||||
0xd0, 0x5d, 0x2d, 0x8f, 0xb8, 0x2c, 0x39, 0x77, 0xad, 0x2c, 0x13, 0x53, 0xae, 0xfb, 0x3b, 0x60,
|
||||
0x87, 0xa8, 0x72, 0xc1, 0x15, 0x12, 0x0a, 0x0d, 0x55, 0x24, 0x09, 0x2a, 0x65, 0x16, 0xcc, 0x0e,
|
||||
0x6f, 0xdb, 0xdd, 0xb7, 0xb0, 0xf1, 0x59, 0x32, 0xae, 0x72, 0x21, 0x35, 0x4a, 0xf2, 0x12, 0x6c,
|
||||
0xd3, 0x9e, 0xa2, 0x24, 0xee, 0xdf, 0xbb, 0xd4, 0x7a, 0x38, 0xa7, 0x54, 0x93, 0xfd, 0x5a, 0xef,
|
||||
0xd1, 0xd5, 0x2f, 0xaf, 0x76, 0x75, 0xe3, 0x59, 0x3f, 0x6f, 0x3c, 0xeb, 0xfa, 0xc6, 0xb3, 0x7e,
|
||||
0xfc, 0xf6, 0x6a, 0x71, 0xdd, 0xec, 0xf9, 0xde, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x69, 0x13,
|
||||
0x2a, 0x43, 0x3e, 0x04, 0x00, 0x00,
|
||||
// 579 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xcf, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xc6, 0xe3, 0xa6, 0x4d, 0xec, 0x69, 0x53, 0xcc, 0x8a, 0x3f, 0x4b, 0xa8, 0xa2, 0xc8, 0xe2,
|
||||
0x90, 0x0b, 0x8e, 0x68, 0x01, 0xf5, 0x58, 0x25, 0x15, 0xa2, 0xaa, 0x28, 0xc5, 0xe6, 0xc4, 0x6d,
|
||||
0xed, 0x4c, 0x8d, 0x69, 0xb2, 0x6b, 0x76, 0xd7, 0x55, 0xd3, 0x27, 0xe1, 0x91, 0x7a, 0xe4, 0x11,
|
||||
0x4a, 0x79, 0x11, 0xe4, 0x75, 0xea, 0x34, 0xa4, 0x85, 0x4b, 0x34, 0xf3, 0x7d, 0xbf, 0x99, 0xd9,
|
||||
0xac, 0x76, 0x0c, 0xcf, 0x59, 0x82, 0x5c, 0xf7, 0xcd, 0x6f, 0x16, 0xf5, 0x27, 0xa8, 0x14, 0x4b,
|
||||
0xd0, 0xcf, 0xa4, 0xd0, 0x82, 0x34, 0x67, 0x72, 0xfb, 0x65, 0x92, 0xea, 0xaf, 0x79, 0xe4, 0xc7,
|
||||
0x62, 0xd2, 0x4f, 0x44, 0x22, 0xfa, 0xc6, 0x8f, 0xf2, 0x13, 0x93, 0x99, 0xc4, 0x44, 0x65, 0x9d,
|
||||
0x77, 0xd5, 0x80, 0x66, 0x80, 0xdf, 0x73, 0x54, 0x9a, 0xec, 0x82, 0x23, 0x32, 0x94, 0x4c, 0xa7,
|
||||
0x82, 0x53, 0xab, 0x6b, 0xf5, 0x36, 0xb7, 0xdb, 0xfe, 0xac, 0xaf, 0x3f, 0x83, 0xfc, 0x8f, 0x37,
|
||||
0x44, 0x30, 0x87, 0xc9, 0x1b, 0xb0, 0x47, 0x4c, 0xb3, 0x88, 0x29, 0xa4, 0x2b, 0xa6, 0xf0, 0xd9,
|
||||
0x52, 0xe1, 0xfe, 0x0c, 0x08, 0x2a, 0x94, 0x78, 0xb0, 0x91, 0x21, 0xca, 0x83, 0xe3, 0x50, 0xcb,
|
||||
0x94, 0x27, 0xb4, 0xde, 0xb5, 0x7a, 0x4e, 0xb0, 0xa0, 0x91, 0x2e, 0xac, 0x2b, 0x94, 0x67, 0x28,
|
||||
0x0f, 0xf8, 0x08, 0xcf, 0xe9, 0x6a, 0xd7, 0xea, 0xb5, 0x82, 0xdb, 0x12, 0x69, 0x83, 0xad, 0x51,
|
||||
0xe9, 0x23, 0x36, 0x41, 0xba, 0x66, 0x3a, 0x54, 0x39, 0x79, 0x0b, 0x4f, 0x12, 0x21, 0x92, 0x31,
|
||||
0x0e, 0xc7, 0x22, 0x1f, 0x1d, 0x4b, 0xf1, 0x0d, 0xe3, 0x92, 0x6c, 0x18, 0xf2, 0x1e, 0x97, 0xbc,
|
||||
0x86, 0xc7, 0xb7, 0x9c, 0x50, 0x0b, 0xc9, 0x12, 0x3c, 0xc4, 0x29, 0x6d, 0x9a, 0xb2, 0xbb, 0x4d,
|
||||
0x32, 0x80, 0xad, 0x65, 0x63, 0x90, 0xc7, 0xa7, 0x58, 0xce, 0xb4, 0x4d, 0xf1, 0x3f, 0x19, 0xf2,
|
||||
0x0e, 0x3a, 0xcb, 0x7e, 0x98, 0x47, 0xfb, 0xa9, 0xc4, 0x58, 0x0b, 0x39, 0xa5, 0x8e, 0xe9, 0xf2,
|
||||
0x1f, 0x8a, 0xbc, 0x80, 0xd6, 0x85, 0x10, 0xa7, 0x88, 0x19, 0xca, 0x0f, 0xd3, 0x83, 0x7d, 0x0a,
|
||||
0xe6, 0xe6, 0x16, 0xc5, 0x82, 0x42, 0x1d, 0x8f, 0x42, 0xce, 0xb2, 0xa1, 0xc8, 0xb9, 0xa6, 0xeb,
|
||||
0x5d, 0xab, 0x57, 0x0f, 0x16, 0x45, 0xe2, 0x03, 0x29, 0x84, 0x4f, 0xb9, 0xd0, 0x2c, 0x4c, 0x2f,
|
||||
0x70, 0x30, 0xd5, 0xa8, 0xe8, 0x86, 0x41, 0xef, 0x70, 0x0a, 0xbe, 0x1a, 0x33, 0x6f, 0xdd, 0x2a,
|
||||
0xf9, 0x65, 0x87, 0xec, 0xc2, 0xd3, 0xf9, 0xb1, 0xd8, 0xf9, 0x70, 0x9c, 0x22, 0xd7, 0x43, 0x7e,
|
||||
0xce, 0x15, 0xdd, 0x34, 0x45, 0xf7, 0xd9, 0x64, 0x0b, 0x9c, 0xd8, 0xa4, 0x47, 0xf9, 0x84, 0x3e,
|
||||
0x30, 0xec, 0x5c, 0xf0, 0xfa, 0xe0, 0x54, 0xcf, 0x95, 0x38, 0xb0, 0x16, 0x6a, 0x26, 0xb5, 0x5b,
|
||||
0x23, 0x36, 0xac, 0x86, 0x5a, 0x64, 0xae, 0x45, 0x5a, 0xe0, 0xbc, 0x47, 0x26, 0x75, 0x84, 0x4c,
|
||||
0xbb, 0x2b, 0x5e, 0x08, 0xf6, 0xcd, 0x33, 0x25, 0x00, 0x8d, 0xe2, 0xaf, 0x9d, 0x6d, 0xbb, 0xb5,
|
||||
0x2a, 0xde, 0x29, 0x4b, 0xbe, 0x08, 0x71, 0x68, 0x4e, 0xe3, 0xae, 0x14, 0xd6, 0x50, 0x70, 0x95,
|
||||
0x8f, 0xdd, 0x7a, 0x31, 0xe2, 0xa2, 0xe0, 0xdc, 0xd5, 0x22, 0x8c, 0x4d, 0xb8, 0xe6, 0xed, 0x81,
|
||||
0x1d, 0xa0, 0xca, 0x04, 0x57, 0x48, 0x28, 0x34, 0x55, 0x1e, 0xc7, 0xa8, 0x94, 0x59, 0x30, 0x3b,
|
||||
0xb8, 0x49, 0x8b, 0x57, 0x5c, 0xec, 0x45, 0x71, 0x89, 0x66, 0x85, 0xea, 0x41, 0x95, 0x6f, 0xef,
|
||||
0xc1, 0xfa, 0x67, 0xc9, 0xb8, 0xca, 0x84, 0xd4, 0x28, 0xc9, 0x2b, 0xb0, 0x4d, 0x7a, 0x82, 0x92,
|
||||
0xb8, 0x7f, 0xef, 0x59, 0xfb, 0xe1, 0x2d, 0xa5, 0x9c, 0xea, 0xd5, 0x06, 0x8f, 0x2e, 0x7f, 0x75,
|
||||
0x6a, 0x97, 0xd7, 0x1d, 0xeb, 0xe7, 0x75, 0xc7, 0xba, 0xba, 0xee, 0x58, 0x3f, 0x7e, 0x77, 0x6a,
|
||||
0x51, 0xc3, 0x7c, 0x03, 0x76, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x99, 0x54, 0xcb, 0xe8, 0x5a,
|
||||
0x04, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,4 +75,8 @@ message Request {
|
|||
|
||||
message Response {
|
||||
bool success = 1;
|
||||
|
||||
// DataSize is the data size of the database on disk.
|
||||
// It measures after database is requested to stop.
|
||||
int64 dataSize = 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/coreos/dbtester/agent/agentpb"
|
||||
"github.com/coreos/dbtester/pkg/fileinspect"
|
||||
"github.com/gyuho/psn"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
|
@ -127,6 +128,7 @@ func (t *transporterServer) Transfer(ctx context.Context, r *agentpb.Request) (*
|
|||
t.req.ClientNum = r.ClientNum
|
||||
}
|
||||
|
||||
var totalDatabasSize int64
|
||||
switch r.Operation {
|
||||
case agentpb.Request_Start:
|
||||
switch t.req.Database {
|
||||
|
|
@ -242,6 +244,13 @@ func (t *transporterServer) Transfer(ctx context.Context, r *agentpb.Request) (*
|
|||
return nil, err
|
||||
}
|
||||
|
||||
dbs, err := measureDatabasSize(globalFlags, r.Database)
|
||||
if err != nil {
|
||||
plog.Warningf("measureDatabasSize error %v", err)
|
||||
return nil, err
|
||||
}
|
||||
totalDatabasSize = dbs
|
||||
|
||||
case agentpb.Request_Heartbeat:
|
||||
plog.Infof("overwriting clients num %d to %q", t.req.ClientNum, t.clientNumPath)
|
||||
if err := toFile(fmt.Sprintf("%d", t.req.ClientNum), t.clientNumPath); err != nil {
|
||||
|
|
@ -253,5 +262,24 @@ func (t *transporterServer) Transfer(ctx context.Context, r *agentpb.Request) (*
|
|||
}
|
||||
|
||||
plog.Info("Transfer success!")
|
||||
return &agentpb.Response{Success: true}, nil
|
||||
return &agentpb.Response{Success: true, DataSize: totalDatabasSize}, nil
|
||||
}
|
||||
|
||||
func measureDatabasSize(flg flags, rdb agentpb.Request_Database) (int64, error) {
|
||||
switch rdb {
|
||||
case agentpb.Request_etcdv2:
|
||||
return fileinspect.Size(flg.etcdDataDir)
|
||||
case agentpb.Request_etcdv3:
|
||||
return fileinspect.Size(flg.etcdDataDir)
|
||||
case agentpb.Request_ZooKeeper:
|
||||
return fileinspect.Size(flg.zkDataDir)
|
||||
case agentpb.Request_Consul:
|
||||
return fileinspect.Size(flg.consulDataDir)
|
||||
case agentpb.Request_cetcd:
|
||||
return fileinspect.Size(flg.etcdDataDir)
|
||||
case agentpb.Request_zetcd:
|
||||
return fileinspect.Size(flg.etcdDataDir)
|
||||
default:
|
||||
return 0, fmt.Errorf("uknown %q", rdb)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ func commandFunc(cmd *cobra.Command, args []string) error {
|
|||
|
||||
println()
|
||||
time.Sleep(5 * time.Second)
|
||||
if err := step3StopDatabase(cfg); err != nil {
|
||||
idxToResponse, err := step3StopDatabase(cfg)
|
||||
if err != nil {
|
||||
plog.Warning(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ type Config struct {
|
|||
DatabaseEndpoints []string
|
||||
|
||||
Log string `yaml:"log"`
|
||||
DataSizeSummary string `yaml:"data_size_summary"`
|
||||
DataLatencyDistributionSummary string `yaml:"data_latency_distribution_summary"`
|
||||
DataLatencyDistributionPercentile string `yaml:"data_latency_distribution_percentile"`
|
||||
DataLatencyDistributionAll string `yaml:"data_latency_distribution_all"`
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ func TestReadConfig(t *testing.T) {
|
|||
if c.Log != "control.log" {
|
||||
t.Fatalf("unexpected %v", c.Log)
|
||||
}
|
||||
if c.DataSizeSummary != "data-size-summary.csv" {
|
||||
t.Fatalf("unexpected %s", c.DataSizeSummary)
|
||||
}
|
||||
if c.DataLatencyDistributionSummary != "data-latency-distribution-summary.csv" {
|
||||
t.Fatalf("unexpected %s", c.DataLatencyDistributionSummary)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ agent_port: 3500
|
|||
database_port: 2379
|
||||
|
||||
log: control.log
|
||||
data_size_summary: data-size-summary.csv
|
||||
data_latency_distribution_summary: data-latency-distribution-summary.csv
|
||||
data_latency_distribution_percentile: data-latency-distribution-percentile.csv
|
||||
data_latency_distribution_all: data-latency-distribution-all.csv
|
||||
|
|
|
|||
|
|
@ -22,38 +22,45 @@ import (
|
|||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func bcastReq(cfg Config, op agentpb.Request_Operation) error {
|
||||
func bcastReq(cfg Config, op agentpb.Request_Operation) (map[int]agentpb.Response, error) {
|
||||
req := cfg.ToRequest()
|
||||
req.Operation = op
|
||||
|
||||
donec, errc := make(chan struct{}), make(chan error)
|
||||
type result struct {
|
||||
idx int
|
||||
r agentpb.Response
|
||||
}
|
||||
donec, errc := make(chan result), make(chan error)
|
||||
for i := range cfg.PeerIPs {
|
||||
go func(i int) {
|
||||
if err := sendReq(cfg.AgentEndpoints[i], req, i); err != nil {
|
||||
if resp, err := sendReq(cfg.AgentEndpoints[i], req, i); err != nil {
|
||||
errc <- err
|
||||
} else {
|
||||
donec <- struct{}{}
|
||||
donec <- result{idx: i, r: *resp}
|
||||
}
|
||||
}(i)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
im := make(map[int]agentpb.Response)
|
||||
|
||||
var errs []error
|
||||
for cnt := 0; cnt != len(cfg.PeerIPs); cnt++ {
|
||||
select {
|
||||
case <-donec:
|
||||
case rs := <-donec:
|
||||
im[rs.idx] = rs.r
|
||||
case err := <-errc:
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
if len(errs) > 0 {
|
||||
return errs[0]
|
||||
return nil, errs[0]
|
||||
}
|
||||
|
||||
return nil
|
||||
return im, nil
|
||||
}
|
||||
|
||||
func sendReq(ep string, req agentpb.Request, i int) error {
|
||||
func sendReq(ep string, req agentpb.Request, i int) (*agentpb.Response, error) {
|
||||
req.ServerIndex = uint32(i)
|
||||
req.ZookeeperMyID = uint32(i + 1)
|
||||
|
||||
|
|
@ -62,7 +69,7 @@ func sendReq(ep string, req agentpb.Request, i int) error {
|
|||
conn, err := grpc.Dial(ep, grpc.WithInsecure())
|
||||
if err != nil {
|
||||
plog.Errorf("grpc.Dial connecting error (%v) [index: %d | endpoint: %q]", err, i, ep)
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer conn.Close()
|
||||
|
|
@ -73,13 +80,14 @@ func sendReq(ep string, req agentpb.Request, i int) error {
|
|||
cancel()
|
||||
if err != nil {
|
||||
plog.Errorf("cli.Transfer error (%v) [index: %d | endpoint: %q]", err, i, ep)
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
plog.Infof("got response [index: %d | endpoint: %q | response: %+v]", i, ep, resp)
|
||||
return nil
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func step1StartDatabase(cfg Config) error {
|
||||
return bcastReq(cfg, agentpb.Request_Start)
|
||||
_, err := bcastReq(cfg, agentpb.Request_Start)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,7 +343,10 @@ func generateReport(cfg Config, h []ReqHandler, reqDone func(), reqGen func(chan
|
|||
saveAllStats(cfg, b.stats, nil)
|
||||
}
|
||||
|
||||
func saveAllStats(cfg Config, stats report.Stats, tsToClientN map[int64]int) {
|
||||
func saveAllStats(cfg Config, stats report.Stats, idxToDataSize map[int]agentpb.Response, tsToClientN map[int64]int) {
|
||||
// cfg.DataSizeSummary
|
||||
saveDataSizeSummary(cfg, idxToDataSize)
|
||||
|
||||
// cfg.DataLatencyDistributionSummary
|
||||
saveDataLatencyDistributionSummary(cfg, stats)
|
||||
|
||||
|
|
@ -389,7 +392,7 @@ func step2StressDatabase(cfg Config) error {
|
|||
|
||||
go func() {
|
||||
plog.Infof("signaling agent with client number %d", copied.Step2.Clients)
|
||||
if err := bcastReq(copied, agentpb.Request_Heartbeat); err != nil {
|
||||
if _, err := bcastReq(copied, agentpb.Request_Heartbeat); err != nil {
|
||||
plog.Panic(err)
|
||||
}
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -21,22 +21,23 @@ import (
|
|||
"github.com/coreos/dbtester/agent/agentpb"
|
||||
)
|
||||
|
||||
func step3StopDatabase(cfg Config) error {
|
||||
func step3StopDatabase(cfg Config) (map[int]agentpb.Response, error) {
|
||||
switch cfg.Step3.Action {
|
||||
case "stop":
|
||||
plog.Info("step 3: stopping databases...")
|
||||
var rm map[int]agentpb.Response
|
||||
var err error
|
||||
for i := 0; i < 5; i++ {
|
||||
if err = bcastReq(cfg, agentpb.Request_Stop); err != nil {
|
||||
if rm, err = bcastReq(cfg, agentpb.Request_Stop); err != nil {
|
||||
plog.Warningf("STOP failed at %s", cfg.PeerIPs[i])
|
||||
time.Sleep(300 * time.Millisecond)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
return err
|
||||
return rm, err
|
||||
|
||||
default:
|
||||
return fmt.Errorf("unknown %q", cfg.Step3.Action)
|
||||
return nil, fmt.Errorf("unknown %q", cfg.Step3.Action)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ func step4UploadLogs(cfg Config) error {
|
|||
if err := uploadToGoogle(cfg.Log, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uploadToGoogle(cfg.DataSizeSummary, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := uploadToGoogle(cfg.DataLatencyDistributionSummary, cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue