-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
MasterProcedure.proto
553 lines (479 loc) · 16.5 KB
/
MasterProcedure.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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
syntax = "proto2";
package hbase.pb;
option java_package = "org.apache.hadoop.hbase.shaded.protobuf.generated";
option java_outer_classname = "MasterProcedureProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
option optimize_for = SPEED;
import "HBase.proto";
import "RPC.proto";
import "Snapshot.proto";
import "Replication.proto";
// ============================================================================
// WARNING - Compatibility rules
// ============================================================================
// This .proto contains the data serialized by the master procedures.
// Each procedure has some state stored to know, which step were executed
// and what were the parameters or data created by the previous steps.
// new code should be able to handle the old format or at least fail cleanly
// triggering a rollback/cleanup.
//
// Procedures that are inheriting from a StateMachineProcedure have an enum:
// - Do not change the number of the 'State' enums.
// doing so, will cause executing the wrong 'step' on the pending
// procedures when they will be replayed.
// - Do not remove items from the enum, new code must be able to handle
// all the previous 'steps'. There may be pending procedure ready to be
// recovered replayed. alternative you can make sure that not-known state
// will result in a failure that will rollback the already executed steps.
// ============================================================================
enum CreateTableState {
CREATE_TABLE_PRE_OPERATION = 1;
CREATE_TABLE_WRITE_FS_LAYOUT = 2;
CREATE_TABLE_ADD_TO_META = 3;
CREATE_TABLE_ASSIGN_REGIONS = 4;
CREATE_TABLE_UPDATE_DESC_CACHE = 5;
CREATE_TABLE_POST_OPERATION = 6;
}
message CreateTableStateData {
required UserInformation user_info = 1;
required TableSchema table_schema = 2;
repeated RegionInfo region_info = 3;
}
enum ModifyTableState {
MODIFY_TABLE_PREPARE = 1;
MODIFY_TABLE_PRE_OPERATION = 2;
MODIFY_TABLE_UPDATE_TABLE_DESCRIPTOR = 3;
MODIFY_TABLE_REMOVE_REPLICA_COLUMN = 4;
MODIFY_TABLE_DELETE_FS_LAYOUT = 5;
MODIFY_TABLE_POST_OPERATION = 6;
MODIFY_TABLE_REOPEN_ALL_REGIONS = 7;
}
message ModifyTableStateData {
required UserInformation user_info = 1;
optional TableSchema unmodified_table_schema = 2;
required TableSchema modified_table_schema = 3;
required bool delete_column_family_in_modify = 4;
}
enum TruncateTableState {
TRUNCATE_TABLE_PRE_OPERATION = 1;
TRUNCATE_TABLE_REMOVE_FROM_META = 2;
TRUNCATE_TABLE_CLEAR_FS_LAYOUT = 3;
TRUNCATE_TABLE_CREATE_FS_LAYOUT = 4;
TRUNCATE_TABLE_ADD_TO_META = 5;
TRUNCATE_TABLE_ASSIGN_REGIONS = 6;
TRUNCATE_TABLE_POST_OPERATION = 7;
}
message TruncateTableStateData {
required UserInformation user_info = 1;
required bool preserve_splits = 2;
optional TableName table_name = 3;
optional TableSchema table_schema = 4;
repeated RegionInfo region_info = 5;
}
enum DeleteTableState {
DELETE_TABLE_PRE_OPERATION = 1;
DELETE_TABLE_REMOVE_FROM_META = 2;
DELETE_TABLE_CLEAR_FS_LAYOUT = 3;
DELETE_TABLE_UPDATE_DESC_CACHE = 4;
DELETE_TABLE_UNASSIGN_REGIONS = 5;
DELETE_TABLE_POST_OPERATION = 6;
}
message DeleteTableStateData {
required UserInformation user_info = 1;
required TableName table_name = 2;
repeated RegionInfo region_info = 3;
}
enum CreateNamespaceState {
CREATE_NAMESPACE_PREPARE = 1;
CREATE_NAMESPACE_CREATE_DIRECTORY = 2;
CREATE_NAMESPACE_INSERT_INTO_NS_TABLE = 3;
CREATE_NAMESPACE_UPDATE_ZK = 4[deprecated=true];
CREATE_NAMESPACE_SET_NAMESPACE_QUOTA = 5;
}
message CreateNamespaceStateData {
required NamespaceDescriptor namespace_descriptor = 1;
}
enum ModifyNamespaceState {
MODIFY_NAMESPACE_PREPARE = 1;
MODIFY_NAMESPACE_UPDATE_NS_TABLE = 2;
MODIFY_NAMESPACE_UPDATE_ZK = 3[deprecated=true];
}
message ModifyNamespaceStateData {
required NamespaceDescriptor namespace_descriptor = 1;
optional NamespaceDescriptor unmodified_namespace_descriptor = 2;
}
enum DeleteNamespaceState {
DELETE_NAMESPACE_PREPARE = 1;
DELETE_NAMESPACE_DELETE_FROM_NS_TABLE = 2;
DELETE_NAMESPACE_REMOVE_FROM_ZK = 3[deprecated=true];
DELETE_NAMESPACE_DELETE_DIRECTORIES = 4;
DELETE_NAMESPACE_REMOVE_NAMESPACE_QUOTA = 5;
}
message DeleteNamespaceStateData {
required string namespace_name = 1;
optional NamespaceDescriptor namespace_descriptor = 2;
}
enum EnableTableState {
ENABLE_TABLE_PREPARE = 1;
ENABLE_TABLE_PRE_OPERATION = 2;
ENABLE_TABLE_SET_ENABLING_TABLE_STATE = 3;
ENABLE_TABLE_MARK_REGIONS_ONLINE = 4;
ENABLE_TABLE_SET_ENABLED_TABLE_STATE = 5;
ENABLE_TABLE_POST_OPERATION = 6;
}
message EnableTableStateData {
required UserInformation user_info = 1;
required TableName table_name = 2;
// not used any more, always false
required bool skip_table_state_check = 3[deprecated=true];
}
enum DisableTableState {
DISABLE_TABLE_PREPARE = 1;
DISABLE_TABLE_PRE_OPERATION = 2;
DISABLE_TABLE_SET_DISABLING_TABLE_STATE = 3;
DISABLE_TABLE_MARK_REGIONS_OFFLINE = 4;
DISABLE_TABLE_SET_DISABLED_TABLE_STATE = 5;
DISABLE_TABLE_POST_OPERATION = 6;
DISABLE_TABLE_ADD_REPLICATION_BARRIER = 7;
}
message DisableTableStateData {
required UserInformation user_info = 1;
required TableName table_name = 2;
required bool skip_table_state_check = 3;
}
message RestoreParentToChildRegionsPair {
required string parent_region_name = 1;
required string child1_region_name = 2;
required string child2_region_name = 3;
}
enum CloneSnapshotState {
CLONE_SNAPSHOT_PRE_OPERATION = 1;
CLONE_SNAPSHOT_WRITE_FS_LAYOUT = 2;
CLONE_SNAPSHOT_ADD_TO_META = 3;
CLONE_SNAPSHOT_ASSIGN_REGIONS = 4;
CLONE_SNAPSHOT_UPDATE_DESC_CACHE = 5;
CLONE_SNAPSHOT_POST_OPERATION = 6;
CLONE_SNAPHOST_RESTORE_ACL = 7;
}
message CloneSnapshotStateData {
required UserInformation user_info = 1;
required SnapshotDescription snapshot = 2;
required TableSchema table_schema = 3;
repeated RegionInfo region_info = 4;
repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 5;
}
enum RestoreSnapshotState {
RESTORE_SNAPSHOT_PRE_OPERATION = 1;
RESTORE_SNAPSHOT_UPDATE_TABLE_DESCRIPTOR = 2;
RESTORE_SNAPSHOT_WRITE_FS_LAYOUT = 3;
RESTORE_SNAPSHOT_UPDATE_META = 4;
RESTORE_SNAPSHOT_RESTORE_ACL = 5;
}
message RestoreSnapshotStateData {
required UserInformation user_info = 1;
required SnapshotDescription snapshot = 2;
required TableSchema modified_table_schema = 3;
repeated RegionInfo region_info_for_restore = 4;
repeated RegionInfo region_info_for_remove = 5;
repeated RegionInfo region_info_for_add = 6;
repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 7;
}
enum DispatchMergingRegionsState {
DISPATCH_MERGING_REGIONS_PREPARE = 1;
DISPATCH_MERGING_REGIONS_PRE_OPERATION = 2;
DISPATCH_MERGING_REGIONS_MOVE_REGION_TO_SAME_RS = 3;
DISPATCH_MERGING_REGIONS_DO_MERGE_IN_RS = 4;
DISPATCH_MERGING_REGIONS_POST_OPERATION = 5;
}
message DispatchMergingRegionsStateData {
required UserInformation user_info = 1;
required TableName table_name = 2;
repeated RegionInfo region_info = 3;
optional bool forcible = 4;
}
enum SplitTableRegionState {
SPLIT_TABLE_REGION_PREPARE = 1;
SPLIT_TABLE_REGION_PRE_OPERATION = 2;
SPLIT_TABLE_REGION_CLOSE_PARENT_REGION = 3;
SPLIT_TABLE_REGION_CREATE_DAUGHTER_REGIONS = 4;
SPLIT_TABLE_REGION_WRITE_MAX_SEQUENCE_ID_FILE = 5;
SPLIT_TABLE_REGION_PRE_OPERATION_BEFORE_META = 6;
SPLIT_TABLE_REGION_UPDATE_META = 7;
SPLIT_TABLE_REGION_PRE_OPERATION_AFTER_META = 8;
SPLIT_TABLE_REGION_OPEN_CHILD_REGIONS = 9;
SPLIT_TABLE_REGION_POST_OPERATION = 10;
SPLIT_TABLE_REGIONS_CHECK_CLOSED_REGIONS = 11;
}
message SplitTableRegionStateData {
required UserInformation user_info = 1;
required RegionInfo parent_region_info = 2;
repeated RegionInfo child_region_info = 3;
}
enum MergeTableRegionsState {
MERGE_TABLE_REGIONS_PREPARE = 1;
MERGE_TABLE_REGIONS_PRE_OPERATION = 2;
MERGE_TABLE_REGIONS_PRE_MERGE_OPERATION = 3;
MERGE_TABLE_REGIONS_CLOSE_REGIONS = 4;
MERGE_TABLE_REGIONS_CREATE_MERGED_REGION = 5;
MERGE_TABLE_REGIONS_WRITE_MAX_SEQUENCE_ID_FILE = 6;
MERGE_TABLE_REGIONS_PRE_MERGE_COMMIT_OPERATION = 7;
MERGE_TABLE_REGIONS_UPDATE_META = 8;
MERGE_TABLE_REGIONS_POST_MERGE_COMMIT_OPERATION = 9;
MERGE_TABLE_REGIONS_OPEN_MERGED_REGION = 10;
MERGE_TABLE_REGIONS_POST_OPERATION = 11;
MERGE_TABLE_REGIONS_CHECK_CLOSED_REGIONS = 12;
}
message MergeTableRegionsStateData {
required UserInformation user_info = 1;
repeated RegionInfo region_info = 2;
optional RegionInfo merged_region_info = 3;
optional bool forcible = 4 [default = false];
}
message ServerCrashStateData {
required ServerName server_name = 1;
// optional bool DEPRECATED_distributed_log_replay = 2;
repeated RegionInfo regions_on_crashed_server = 3;
repeated RegionInfo regions_assigned = 4;
optional bool carrying_meta = 5;
optional bool should_split_wal = 6 [default = true];
}
message RecoverMetaStateData {
optional ServerName failed_meta_server = 1;
optional bool should_split_wal = 2 [default = true];
optional int32 replica_id = 3 [default = 0];
}
enum ServerCrashState {
SERVER_CRASH_START = 1;
SERVER_CRASH_PROCESS_META = 2[deprecated=true];
SERVER_CRASH_GET_REGIONS = 3;
SERVER_CRASH_NO_SPLIT_LOGS = 4[deprecated=true];
SERVER_CRASH_SPLIT_LOGS = 5;
// Removed SERVER_CRASH_PREPARE_LOG_REPLAY = 6;
// Removed SERVER_CRASH_CALC_REGIONS_TO_ASSIGN = 7;
SERVER_CRASH_ASSIGN = 8;
SERVER_CRASH_WAIT_ON_ASSIGN = 9;
SERVER_CRASH_SPLIT_META_LOGS = 10;
SERVER_CRASH_ASSIGN_META = 11;
SERVER_CRASH_HANDLE_RIT2 = 20[deprecated=true];
SERVER_CRASH_FINISH = 100;
}
enum RecoverMetaState {
RECOVER_META_PREPARE = 0;
RECOVER_META_SPLIT_LOGS = 1;
RECOVER_META_ASSIGN_REGIONS = 2;
}
enum RegionTransitionState {
REGION_TRANSITION_QUEUE = 1;
REGION_TRANSITION_DISPATCH = 2;
REGION_TRANSITION_FINISH = 3;
}
message AssignRegionStateData {
required RegionTransitionState transition_state = 1;
required RegionInfo region_info = 2;
optional bool force_new_plan = 3 [default = false];
optional ServerName target_server = 4;
// Current attempt index used for expotential backoff when stuck
optional int32 attempt = 5;
}
message UnassignRegionStateData {
required RegionTransitionState transition_state = 1;
required RegionInfo region_info = 2;
// This is optional info; it is the servername we will
// subsequently assign the region too... it may be null.
optional ServerName destination_server = 3;
// This is the server currently hosting the Region, the
// server we will send the unassign rpc too.
optional ServerName hosting_server = 5;
optional bool force = 4 [default = false];
optional bool remove_after_unassigning = 6 [default = false];
// Current attempt index used for expotential backoff when stuck
optional int32 attempt = 7;
}
enum MoveRegionState {
MOVE_REGION_PREPARE = 0;
MOVE_REGION_UNASSIGN = 1;
MOVE_REGION_ASSIGN = 2;
}
message MoveRegionStateData {
optional RegionInfo region_info = 1;
required ServerName source_server = 2;
// if destination server not specified, its selected with load balancer
optional ServerName destination_server = 3;
}
enum GCRegionState {
GC_REGION_PREPARE = 1;
GC_REGION_ARCHIVE = 2;
GC_REGION_PURGE_METADATA = 3;
}
message GCRegionStateData {
required RegionInfo region_info = 1;
}
enum GCMergedRegionsState {
GC_MERGED_REGIONS_PREPARE = 1;
GC_MERGED_REGIONS_PURGE = 2;
GC_REGION_EDIT_METADATA = 3;
}
message GCMergedRegionsStateData {
required RegionInfo parent_a = 1;
required RegionInfo parent_b = 2;
required RegionInfo merged_child = 3;
}
enum PeerModificationState {
PRE_PEER_MODIFICATION = 1;
UPDATE_PEER_STORAGE = 2;
REFRESH_PEER_ON_RS = 3;
SERIAL_PEER_REOPEN_REGIONS = 4;
SERIAL_PEER_UPDATE_LAST_PUSHED_SEQ_ID = 5;
SERIAL_PEER_SET_PEER_ENABLED = 6;
SERIAL_PEER_ENABLE_PEER_REFRESH_PEER_ON_RS = 7;
POST_PEER_MODIFICATION = 8;
}
enum PeerSyncReplicationStateTransitionState {
PRE_PEER_SYNC_REPLICATION_STATE_TRANSITION = 1;
SET_PEER_NEW_SYNC_REPLICATION_STATE = 2;
REFRESH_PEER_SYNC_REPLICATION_STATE_ON_RS_BEGIN = 3;
REOPEN_ALL_REGIONS_IN_PEER = 4;
SYNC_REPLICATION_UPDATE_LAST_PUSHED_SEQ_ID_FOR_SERIAL_PEER = 5;
REPLAY_REMOTE_WAL_IN_PEER = 6;
REMOVE_ALL_REPLICATION_QUEUES_IN_PEER = 7;
TRANSIT_PEER_NEW_SYNC_REPLICATION_STATE = 8;
REFRESH_PEER_SYNC_REPLICATION_STATE_ON_RS_END = 9;
SYNC_REPLICATION_SET_PEER_ENABLED = 10;
SYNC_REPLICATION_ENABLE_PEER_REFRESH_PEER_ON_RS = 11;
CREATE_DIR_FOR_REMOTE_WAL = 12;
POST_PEER_SYNC_REPLICATION_STATE_TRANSITION = 13;
}
message PeerModificationStateData {
required string peer_id = 1;
}
enum PeerModificationType {
ADD_PEER = 1;
REMOVE_PEER = 2;
ENABLE_PEER = 3;
DISABLE_PEER = 4;
UPDATE_PEER_CONFIG = 5;
TRANSIT_SYNC_REPLICATION_STATE = 6;
}
message RefreshPeerStateData {
required string peer_id = 1;
required PeerModificationType type = 2;
required ServerName target_server = 3;
/** We need multiple stages for sync replication state transition **/
optional uint32 stage = 4 [default = 0];
}
message RefreshPeerParameter {
required string peer_id = 1;
required PeerModificationType type = 2;
required ServerName target_server = 3;
/** We need multiple stages for sync replication state transition **/
optional uint32 stage = 4 [default = 0];;
}
message PeerProcedureStateData {
required string peer_id = 1;
}
message AddPeerStateData {
required ReplicationPeer peer_config = 1;
required bool enabled = 2;
}
message UpdatePeerConfigStateData {
required ReplicationPeer peer_config = 1;
optional ReplicationPeer old_peer_config = 2;
required bool enabled = 3;
}
message RemovePeerStateData {
optional ReplicationPeer peer_config = 1;
}
message EnablePeerStateData {
}
message DisablePeerStateData {
}
enum ReopenTableRegionsState {
REOPEN_TABLE_REGIONS_GET_REGIONS = 1;
REOPEN_TABLE_REGIONS_REOPEN_REGIONS = 2;
REOPEN_TABLE_REGIONS_CONFIRM_REOPENED = 3;
}
message ReopenTableRegionsStateData {
required TableName table_name = 1;
repeated RegionLocation region = 2;
}
enum InitMetaState {
INIT_META_ASSIGN_META = 1;
INIT_META_CREATE_NAMESPACES = 2;
}
message InitMetaStateData {
}
message TransitPeerSyncReplicationStateStateData {
/** Could be null if we fail in pre check, so optional */
optional SyncReplicationState fromState = 1;
required SyncReplicationState toState = 2;
}
enum RecoverStandbyState {
RENAME_SYNC_REPLICATION_WALS_DIR = 1;
REGISTER_PEER_TO_WORKER_STORAGE = 2;
DISPATCH_WALS = 3;
UNREGISTER_PEER_FROM_WORKER_STORAGE = 4;
SNAPSHOT_SYNC_REPLICATION_WALS_DIR = 5;
}
enum SyncReplicationReplayWALState {
ASSIGN_WORKER = 1;
DISPATCH_WALS_TO_WORKER = 2;
RELEASE_WORKER = 3;
}
message RecoverStandbyStateData {
required bool serial = 1;
}
message SyncReplicationReplayWALStateData {
required string peer_id = 1;
repeated string wal = 2;
optional ServerName worker = 3;
}
message SyncReplicationReplayWALRemoteStateData {
required string peer_id = 1;
repeated string wal = 2;
required ServerName target_server = 3;
}
message ReplaySyncReplicationWALParameter {
required string peer_id = 1;
repeated string wal = 2;
}
enum RegionStateTransitionState {
REGION_STATE_TRANSITION_GET_ASSIGN_CANDIDATE = 1;
REGION_STATE_TRANSITION_OPEN = 2;
REGION_STATE_TRANSITION_CONFIRM_OPENED = 3;
REGION_STATE_TRANSITION_CLOSE = 4;
REGION_STATE_TRANSITION_CONFIRM_CLOSED = 5;
}
message RegionStateTransitionStateData {
required RegionStateTransitionState initialState = 1;
required RegionStateTransitionState lastState = 2;
optional ServerName assign_candidate = 3;
required bool force_new_plan = 4;
optional bool override = 5 [default = false];
}
message RegionRemoteProcedureBaseStateData {
required RegionInfo region = 1;
required ServerName target_server = 2;
}
message OpenRegionProcedureStateData {
}
message CloseRegionProcedureStateData {
optional ServerName assign_candidate = 1;
}