forked from opencurve/curve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
heartbeat.proto
175 lines (160 loc) · 5.51 KB
/
heartbeat.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
* Copyright (c) 2020 NetEase Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Project: curve
* Created Date: Mon Nov 19 2018
* Author: xuchaojie
*/
syntax = "proto2";
import "proto/common.proto";
import "proto/scan.proto";
package curve.mds.heartbeat;
option cc_generic_services = true;
option go_package = "proto/heartbeat";
message CopySetInfo {
required uint32 logicalPoolId = 1;
required uint32 copysetId = 2;
// copyset replicas, IP:PORT:ID, e.g. 127.0.0.1:8200:0
repeated common.Peer peers = 3;
// epoch, 用来标记配置变更,每变更一次,epoch会增加
required uint64 epoch = 4;
// 该复制组的leader
required common.Peer leaderPeer = 5;
// 配置变更相关信息
optional ConfigChangeInfo configChangeInfo = 6;
// copyset的性能信息
optional CopysetStatistics stats = 7;
// whether the current copyset is on scaning
optional bool scaning = 8;
// timestamp for last success scan (seconds)
optional uint64 lastScanSec = 9;
// the detail information for inconsistent copyset
repeated chunkserver.ScanMap scanMap = 10;
};
message ConfigChangeInfo {
required common.Peer peer = 1;
// 配置变更的类型
required ConfigChangeType type = 2;
// 配置变更是否成功
required bool finished = 3;
// 变更的error信息
optional CandidateError err = 4;
};
message CandidateError {
required uint32 errType = 1;
required string errMsg = 2;
};
message CopysetStatistics {
required uint32 readRate = 1;
required uint32 writeRate = 2;
required uint32 readIOPS = 3;
required uint32 writeIOPS = 4;
}
message DiskState {
required uint32 errType = 1;
required string errMsg = 2;
}
message ChunkServerStatisticInfo {
required uint32 readRate = 1;
required uint32 writeRate = 2;
required uint32 readIOPS = 3;
required uint32 writeIOPS = 4;
// 已使用的chunk占用的磁盘空间
required uint64 chunkSizeUsedBytes = 5;
// chunkfilepool中未使用的chunk占用的磁盘空间
required uint64 chunkSizeLeftBytes = 6;
// 回收站中chunk占用的磁盘空间
required uint64 chunkSizeTrashedBytes = 7;
// chunkfilepool的大小
optional uint64 chunkFilepoolSize = 8;
};
message ChunkServerHeartbeatRequest {
required uint32 chunkServerID = 1;
required string token = 2;
required string ip = 3;
required uint32 port = 4;
optional uint64 startTime = 5;
required DiskState diskState = 6;
required uint64 diskCapacity = 7;
required uint64 diskUsed = 8;
// 返回该chunk上所有copyset的信息
repeated CopySetInfo copysetInfos = 9;
// 时间窗口内该chunkserver上leader的个数
required uint32 leaderCount = 10;
// 时间窗口内该chunkserver上copyset的个数
required uint32 copysetCount = 11;
// chunkServer相关的统计信息
optional ChunkServerStatisticInfo stats = 12;
};
enum ConfigChangeType {
// 配置变更命令: leader转换
TRANSFER_LEADER = 1;
// 配置变更命令: 复制组增加一个成员
ADD_PEER = 2;
// 配置变更命令: 复制组删除一个成员
REMOVE_PEER = 3;
// 配置变更命令: 没有配置变更
NONE = 4;
// 配置变更命令:change复制组一个成员
CHANGE_PEER = 5;
// start scan on the peer
START_SCAN_PEER = 6;
// cancel scan on the peer
CANCEL_SCAN_PEER = 7;
};
message CopySetConf {
required uint32 logicalPoolId = 1;
required uint32 copysetId = 2;
repeated common.Peer peers = 3;
required uint64 epoch = 4;
optional ConfigChangeType type = 5;
// configchangeItem 是目标节点
// 对于TRANSFER_LEADER: 表示目标节点; 对于ADD_PEER: 表示待加入节点
// 对于REMOVE_PEER: 表示待删除节点; 对于CHANGE_PEER: 表示待加入节点
// SCAN_PEER: to scan the node
optional common.Peer configchangeItem = 6;
// oldPeer, 这个只在ConfigChangeType=对于CHANGE_PEER的情况下会赋值,
// 表示待删除节点。
// chunkserver收到CHANGE_PEER,根据peers,configchangeItem,oldPeer拼出新的conf
optional common.Peer oldPeer = 7;
};
enum HeartbeatStatusCode {
// 正常返回
hbOK = 0;
// 必要的参数为初始化
hbParamUnInitialized = 1;
// chunkserver不在topology中
hbChunkserverUnknown = 2;
// chunkserver状态为retired
hbChunkserverRetired = 3;
// chunkserver的ip和port与topology中的不匹配
hbChunkserverIpPortNotMatch = 4;
// chunkserver的token不匹配
hbChunkserverTokenNotMatch = 5;
// 无copyset上报
hbRequestNoCopyset = 6;
// copyset转换为topology格式失败
hbAnalyseCopysetError = 7;
}
message ChunkServerHeartbeatResponse {
// 返回需要进行变更的copyset的信息
repeated CopySetConf needUpdateCopysets = 1;
// 错误码
optional HeartbeatStatusCode statusCode = 2;
};
service HeartbeatService {
rpc ChunkServerHeartbeat (ChunkServerHeartbeatRequest) returns (ChunkServerHeartbeatResponse);
}