-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathydb_maintenance.proto
273 lines (233 loc) · 7.87 KB
/
ydb_maintenance.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
syntax = "proto3";
option cc_enable_arenas = true;
import "src/api/protos/annotations/validation.proto";
import "src/api/protos/ydb_discovery.proto";
import "src/api/protos/ydb_operation.proto";
import "src/api/protos/ydb_status_codes.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
package Ydb.Maintenance;
option java_package = "com.yandex.ydb.maintenance";
// Represents state of an abstract item: e.g. node or device.
enum ItemState {
// Item's state couldn't be identified.
ITEM_STATE_UNSPECIFIED = 0;
// Item is up.
ITEM_STATE_UP = 1;
// Item is down due to planned maintenance.
ITEM_STATE_MAINTENANCE = 2;
// Item is down off-schedule.
ITEM_STATE_DOWN = 3;
}
message Node {
message StorageNode {
}
message DynamicNode {
string tenant = 1;
}
uint32 node_id = 1;
string host = 2;
uint32 port = 3;
Ydb.Discovery.NodeLocation location = 4;
ItemState state = 5;
oneof type {
StorageNode storage = 6;
DynamicNode dynamic = 7;
}
// start_time defines time when node was registered in cms.
google.protobuf.Timestamp start_time = 8;
// version defines YDB version for current Node.
// For example, 'ydb-stable-24-1'.
string version = 9;
}
message ListClusterNodesRequest {
Ydb.Operations.OperationParams operation_params = 1;
}
message ListClusterNodesResult {
repeated Node nodes = 1;
}
message ListClusterNodesResponse {
// operation.result = ListClusterNodesResult
Ydb.Operations.Operation operation = 1;
}
enum AvailabilityMode {
AVAILABILITY_MODE_UNSPECIFIED = 0;
// In this mode allowed:
// - at most 1 unavailable disk in each affected storage group;
// - at most 1 unavailable state storage ring.
// For nodes tenant and cluster policies are followed.
AVAILABILITY_MODE_STRONG = 1;
// In this mode:
// - total number of an unavailable disks in each affected storage group
// shouldn't exceed number of parity parts in that group;
// - it is allowed to disable (n_to_select - 1) / 2 state storage rings.
// Nodes are handled as in strong mode.
AVAILABILITY_MODE_WEAK = 2;
// Ignore any storage group & state storage checks.
// Using this mode might cause data unavailability.
AVAILABILITY_MODE_FORCE = 3;
}
message MaintenanceTaskOptions {
// User-defined _unique_ task identifier.
string task_uid = 1 [(length).le = 128];
// User-defined description.
string description = 2 [(length).le = 128];
// Availability mode.
AvailabilityMode availability_mode = 3;
bool dry_run = 4;
// Priority of the task. Lower value indicates higher priority.
int32 priority = 5 [(value) = "[-100; 100]"];
}
// Used to describe the scope of a single action.
message ActionScope {
message PDiskId {
uint32 node_id = 1;
uint32 pdisk_id = 2;
}
message PDiskLocation {
string host = 1 [(length).le = 255];
string path = 2 [(length).le = 255];
}
message PDisk {
oneof pdisk {
PDiskId pdisk_id = 1;
PDiskLocation pdisk_location = 2;
}
}
oneof scope {
uint32 node_id = 1;
string host = 2 [(length).le = 255];
PDisk pdisk = 3;
}
}
// Taking an exclusive lock to perform maintenance.
message LockAction {
ActionScope scope = 1;
google.protobuf.Duration duration = 2;
}
message Action {
oneof action {
LockAction lock_action = 1;
}
}
message ActionGroup {
repeated Action actions = 1 [(size).ge = 1];
}
message CreateMaintenanceTaskRequest {
Ydb.Operations.OperationParams operation_params = 1;
MaintenanceTaskOptions task_options = 2;
repeated ActionGroup action_groups = 3 [(size).ge = 1];
}
message RefreshMaintenanceTaskRequest {
Ydb.Operations.OperationParams operation_params = 1;
string task_uid = 2 [(length).le = 128];
}
message ActionUid {
string task_uid = 1 [(length).le = 128];
// Unique ids within a single task, assigned by the server.
string group_id = 2 [(length).le = 128];
string action_id = 3 [(length).le = 128];
}
message ActionState {
enum ActionStatus {
ACTION_STATUS_UNSPECIFIED = 0;
// Action can't be performed now.
ACTION_STATUS_PENDING = 1;
// Action performed: e.g. lock is taken.
ACTION_STATUS_PERFORMED = 2;
}
enum ActionReason {
ACTION_REASON_UNSPECIFIED = 0;
// Everything is ok.
ACTION_REASON_OK = 1;
// Affected storage group has too many unavailable (locked or down) vdisks.
ACTION_REASON_TOO_MANY_UNAVAILABLE_VDISKS = 2;
// Too many unavailable state storage rings.
ACTION_REASON_TOO_MANY_UNAVAILABLE_STATE_STORAGE_RINGS = 3;
// Too many disabled nodes (storage & dynamic) in cluster.
ACTION_REASON_DISABLED_NODES_LIMIT_REACHED = 4;
// Too many disabled dynamic nodes of specific tenant.
ACTION_REASON_TENANT_DISABLED_NODES_LIMIT_REACHED = 5;
// Wrong request.
ACTION_REASON_WRONG_REQUEST = 6;
// Too many unavailable nodes with system tablets.
ACTION_REASON_SYS_TABLETS_NODE_LIMIT_REACHED = 7;
// Generic reason.
ACTION_REASON_GENERIC = 8;
}
Action action = 1;
ActionUid action_uid = 2;
ActionStatus status = 3;
ActionReason reason = 4;
string reason_details = 6;
google.protobuf.Timestamp deadline = 5;
}
message ActionGroupStates {
repeated ActionState action_states = 1;
}
message MaintenanceTaskResult {
string task_uid = 1;
repeated ActionGroupStates action_group_states = 2;
// Try again after this deadline. Specified if there are no performed actions.
optional google.protobuf.Timestamp retry_after = 3;
// The time when the mainteance task was created.
google.protobuf.Timestamp create_time = 4;
// The last time when the mainteance task was refreshed. Initially equals to create_time.
google.protobuf.Timestamp last_refresh_time = 5;
}
message MaintenanceTaskResponse {
// operation.result = MaintenanceTaskResult
Ydb.Operations.Operation operation = 1;
}
message GetMaintenanceTaskRequest {
Ydb.Operations.OperationParams operation_params = 1;
string task_uid = 2 [(length).le = 128];
}
message GetMaintenanceTaskResult {
MaintenanceTaskOptions task_options = 1;
repeated ActionGroupStates action_group_states = 2;
// The time when the mainteance task was created.
google.protobuf.Timestamp create_time = 3;
// The last time when the mainteance task was refreshed. Initially equals to create_time.
google.protobuf.Timestamp last_refresh_time = 4;
}
message GetMaintenanceTaskResponse {
// operation.result = GetMaintenanceTaskResult
Ydb.Operations.Operation operation = 1;
}
message ListMaintenanceTasksRequest {
Ydb.Operations.OperationParams operation_params = 1;
// User SID (Security ID).
// If specified, it will return the tasks created by this user.
// Otherwise all tasks will be returned.
optional string user = 2;
}
message ListMaintenanceTasksResult {
repeated string tasks_uids = 1;
}
message ListMaintenanceTasksResponse {
// operation.result = ListMaintenanceTasksResult
Ydb.Operations.Operation operation = 1;
}
message DropMaintenanceTaskRequest {
Ydb.Operations.OperationParams operation_params = 1;
string task_uid = 2 [(length).le = 128];
}
message ManageMaintenanceTaskResponse {
Ydb.Operations.Operation operation = 1;
}
message CompleteActionRequest {
Ydb.Operations.OperationParams operation_params = 1;
repeated ActionUid action_uids = 2 [(size).ge = 1];
}
message ManageActionResult {
message Status {
ActionUid action_uid = 1;
StatusIds.StatusCode status = 2;
}
repeated Status action_statuses = 1;
}
message ManageActionResponse {
// operation.result = ManageActionResult
Ydb.Operations.Operation operation = 1;
}