2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 option java_package = "org.apache.hadoop.hbase.shaded.protobuf.generated";
22 option java_outer_classname = "MasterProcedureProtos";
23 option java_generic_services = true;
24 option java_generate_equals_and_hash = true;
25 option optimize_for = SPEED;
29 import "Snapshot.proto";
30 import "Replication.proto";
31 import "RegionServerStatus.proto";
33 // ============================================================================
34 // WARNING - Compatibility rules
35 // ============================================================================
36 // This .proto contains the data serialized by the master procedures.
37 // Each procedure has some state stored to know, which step were executed
38 // and what were the parameters or data created by the previous steps.
39 // new code should be able to handle the old format or at least fail cleanly
40 // triggering a rollback/cleanup.
42 // Procedures that are inheriting from a StateMachineProcedure have an enum:
43 // - Do not change the number of the 'State' enums.
44 // doing so, will cause executing the wrong 'step' on the pending
45 // procedures when they will be replayed.
46 // - Do not remove items from the enum, new code must be able to handle
47 // all the previous 'steps'. There may be pending procedure ready to be
48 // recovered replayed. alternative you can make sure that not-known state
49 // will result in a failure that will rollback the already executed steps.
50 // ============================================================================
52 enum CreateTableState {
53 CREATE_TABLE_PRE_OPERATION = 1;
54 CREATE_TABLE_WRITE_FS_LAYOUT = 2;
55 CREATE_TABLE_ADD_TO_META = 3;
56 CREATE_TABLE_ASSIGN_REGIONS = 4;
57 CREATE_TABLE_UPDATE_DESC_CACHE = 5;
58 CREATE_TABLE_POST_OPERATION = 6;
61 message CreateTableStateData {
62 required UserInformation user_info = 1;
63 required TableSchema table_schema = 2;
64 repeated RegionInfo region_info = 3;
67 enum ModifyTableState {
68 MODIFY_TABLE_PREPARE = 1;
69 MODIFY_TABLE_PRE_OPERATION = 2;
70 MODIFY_TABLE_UPDATE_TABLE_DESCRIPTOR = 3;
71 MODIFY_TABLE_REMOVE_REPLICA_COLUMN = 4;
72 MODIFY_TABLE_DELETE_FS_LAYOUT = 5;
73 MODIFY_TABLE_POST_OPERATION = 6;
74 MODIFY_TABLE_REOPEN_ALL_REGIONS = 7;
77 message ModifyTableStateData {
78 required UserInformation user_info = 1;
79 optional TableSchema unmodified_table_schema = 2;
80 required TableSchema modified_table_schema = 3;
81 required bool delete_column_family_in_modify = 4;
82 optional bool should_check_descriptor = 5;
85 enum TruncateTableState {
86 TRUNCATE_TABLE_PRE_OPERATION = 1;
87 TRUNCATE_TABLE_REMOVE_FROM_META = 2;
88 TRUNCATE_TABLE_CLEAR_FS_LAYOUT = 3;
89 TRUNCATE_TABLE_CREATE_FS_LAYOUT = 4;
90 TRUNCATE_TABLE_ADD_TO_META = 5;
91 TRUNCATE_TABLE_ASSIGN_REGIONS = 6;
92 TRUNCATE_TABLE_POST_OPERATION = 7;
95 message TruncateTableStateData {
96 required UserInformation user_info = 1;
97 required bool preserve_splits = 2;
98 optional TableName table_name = 3;
99 optional TableSchema table_schema = 4;
100 repeated RegionInfo region_info = 5;
103 enum DeleteTableState {
104 DELETE_TABLE_PRE_OPERATION = 1;
105 DELETE_TABLE_REMOVE_FROM_META = 2;
106 DELETE_TABLE_CLEAR_FS_LAYOUT = 3;
107 DELETE_TABLE_UPDATE_DESC_CACHE = 4;
108 DELETE_TABLE_UNASSIGN_REGIONS = 5;
109 DELETE_TABLE_POST_OPERATION = 6;
112 message DeleteTableStateData {
113 required UserInformation user_info = 1;
114 required TableName table_name = 2;
115 repeated RegionInfo region_info = 3;
118 enum CreateNamespaceState {
119 CREATE_NAMESPACE_PREPARE = 1;
120 CREATE_NAMESPACE_CREATE_DIRECTORY = 2;
121 CREATE_NAMESPACE_INSERT_INTO_NS_TABLE = 3;
122 CREATE_NAMESPACE_UPDATE_ZK = 4[deprecated=true];
123 CREATE_NAMESPACE_SET_NAMESPACE_QUOTA = 5;
126 message CreateNamespaceStateData {
127 required NamespaceDescriptor namespace_descriptor = 1;
130 enum ModifyNamespaceState {
131 MODIFY_NAMESPACE_PREPARE = 1;
132 MODIFY_NAMESPACE_UPDATE_NS_TABLE = 2;
133 MODIFY_NAMESPACE_UPDATE_ZK = 3[deprecated=true];
136 message ModifyNamespaceStateData {
137 required NamespaceDescriptor namespace_descriptor = 1;
138 optional NamespaceDescriptor unmodified_namespace_descriptor = 2;
141 enum DeleteNamespaceState {
142 DELETE_NAMESPACE_PREPARE = 1;
143 DELETE_NAMESPACE_DELETE_FROM_NS_TABLE = 2;
144 DELETE_NAMESPACE_REMOVE_FROM_ZK = 3[deprecated=true];
145 DELETE_NAMESPACE_DELETE_DIRECTORIES = 4;
146 DELETE_NAMESPACE_REMOVE_NAMESPACE_QUOTA = 5;
149 message DeleteNamespaceStateData {
150 required string namespace_name = 1;
151 optional NamespaceDescriptor namespace_descriptor = 2;
154 enum EnableTableState {
155 ENABLE_TABLE_PREPARE = 1;
156 ENABLE_TABLE_PRE_OPERATION = 2;
157 ENABLE_TABLE_SET_ENABLING_TABLE_STATE = 3;
158 ENABLE_TABLE_MARK_REGIONS_ONLINE = 4;
159 ENABLE_TABLE_SET_ENABLED_TABLE_STATE = 5;
160 ENABLE_TABLE_POST_OPERATION = 6;
163 message EnableTableStateData {
164 required UserInformation user_info = 1;
165 required TableName table_name = 2;
166 // not used any more, always false
167 required bool skip_table_state_check = 3[deprecated=true];
170 enum DisableTableState {
171 DISABLE_TABLE_PREPARE = 1;
172 DISABLE_TABLE_PRE_OPERATION = 2;
173 DISABLE_TABLE_SET_DISABLING_TABLE_STATE = 3;
174 DISABLE_TABLE_MARK_REGIONS_OFFLINE = 4;
175 DISABLE_TABLE_SET_DISABLED_TABLE_STATE = 5;
176 DISABLE_TABLE_POST_OPERATION = 6;
177 DISABLE_TABLE_ADD_REPLICATION_BARRIER = 7;
180 message DisableTableStateData {
181 required UserInformation user_info = 1;
182 required TableName table_name = 2;
183 required bool skip_table_state_check = 3;
186 message RestoreParentToChildRegionsPair {
187 required string parent_region_name = 1;
188 required string child1_region_name = 2;
189 required string child2_region_name = 3;
192 enum CloneSnapshotState {
193 CLONE_SNAPSHOT_PRE_OPERATION = 1;
194 CLONE_SNAPSHOT_WRITE_FS_LAYOUT = 2;
195 CLONE_SNAPSHOT_ADD_TO_META = 3;
196 CLONE_SNAPSHOT_ASSIGN_REGIONS = 4;
197 CLONE_SNAPSHOT_UPDATE_DESC_CACHE = 5;
198 CLONE_SNAPSHOT_POST_OPERATION = 6;
199 CLONE_SNAPHOST_RESTORE_ACL = 7;
202 message CloneSnapshotStateData {
203 required UserInformation user_info = 1;
204 required SnapshotDescription snapshot = 2;
205 required TableSchema table_schema = 3;
206 repeated RegionInfo region_info = 4;
207 repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 5;
210 enum RestoreSnapshotState {
211 RESTORE_SNAPSHOT_PRE_OPERATION = 1;
212 RESTORE_SNAPSHOT_UPDATE_TABLE_DESCRIPTOR = 2;
213 RESTORE_SNAPSHOT_WRITE_FS_LAYOUT = 3;
214 RESTORE_SNAPSHOT_UPDATE_META = 4;
215 RESTORE_SNAPSHOT_RESTORE_ACL = 5;
218 message RestoreSnapshotStateData {
219 required UserInformation user_info = 1;
220 required SnapshotDescription snapshot = 2;
221 required TableSchema modified_table_schema = 3;
222 repeated RegionInfo region_info_for_restore = 4;
223 repeated RegionInfo region_info_for_remove = 5;
224 repeated RegionInfo region_info_for_add = 6;
225 repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 7;
228 enum DispatchMergingRegionsState {
229 DISPATCH_MERGING_REGIONS_PREPARE = 1;
230 DISPATCH_MERGING_REGIONS_PRE_OPERATION = 2;
231 DISPATCH_MERGING_REGIONS_MOVE_REGION_TO_SAME_RS = 3;
232 DISPATCH_MERGING_REGIONS_DO_MERGE_IN_RS = 4;
233 DISPATCH_MERGING_REGIONS_POST_OPERATION = 5;
236 message DispatchMergingRegionsStateData {
237 required UserInformation user_info = 1;
238 required TableName table_name = 2;
239 repeated RegionInfo region_info = 3;
240 optional bool forcible = 4;
243 enum SplitTableRegionState {
244 SPLIT_TABLE_REGION_PREPARE = 1;
245 SPLIT_TABLE_REGION_PRE_OPERATION = 2;
246 SPLIT_TABLE_REGION_CLOSE_PARENT_REGION = 3;
247 SPLIT_TABLE_REGION_CREATE_DAUGHTER_REGIONS = 4;
248 SPLIT_TABLE_REGION_WRITE_MAX_SEQUENCE_ID_FILE = 5;
249 SPLIT_TABLE_REGION_PRE_OPERATION_BEFORE_META = 6;
250 SPLIT_TABLE_REGION_UPDATE_META = 7;
251 SPLIT_TABLE_REGION_PRE_OPERATION_AFTER_META = 8;
252 SPLIT_TABLE_REGION_OPEN_CHILD_REGIONS = 9;
253 SPLIT_TABLE_REGION_POST_OPERATION = 10;
254 SPLIT_TABLE_REGIONS_CHECK_CLOSED_REGIONS = 11;
257 message SplitTableRegionStateData {
258 required UserInformation user_info = 1;
259 required RegionInfo parent_region_info = 2;
260 repeated RegionInfo child_region_info = 3;
263 enum MergeTableRegionsState {
264 MERGE_TABLE_REGIONS_PREPARE = 1;
265 MERGE_TABLE_REGIONS_PRE_OPERATION = 2;
266 MERGE_TABLE_REGIONS_PRE_MERGE_OPERATION = 3;
267 MERGE_TABLE_REGIONS_CLOSE_REGIONS = 4;
268 MERGE_TABLE_REGIONS_CREATE_MERGED_REGION = 5;
269 MERGE_TABLE_REGIONS_WRITE_MAX_SEQUENCE_ID_FILE = 6;
270 MERGE_TABLE_REGIONS_PRE_MERGE_COMMIT_OPERATION = 7;
271 MERGE_TABLE_REGIONS_UPDATE_META = 8;
272 MERGE_TABLE_REGIONS_POST_MERGE_COMMIT_OPERATION = 9;
273 MERGE_TABLE_REGIONS_OPEN_MERGED_REGION = 10;
274 MERGE_TABLE_REGIONS_POST_OPERATION = 11;
275 MERGE_TABLE_REGIONS_CHECK_CLOSED_REGIONS = 12;
278 message MergeTableRegionsStateData {
279 required UserInformation user_info = 1;
280 repeated RegionInfo region_info = 2;
281 optional RegionInfo merged_region_info = 3;
282 optional bool forcible = 4 [default = false];
286 message ServerCrashStateData {
287 required ServerName server_name = 1;
288 // optional bool DEPRECATED_distributed_log_replay = 2;
289 repeated RegionInfo regions_on_crashed_server = 3;
290 repeated RegionInfo regions_assigned = 4;
291 optional bool carrying_meta = 5;
292 optional bool should_split_wal = 6 [default = true];
295 message RecoverMetaStateData {
296 optional ServerName failed_meta_server = 1;
297 optional bool should_split_wal = 2 [default = true];
298 optional int32 replica_id = 3 [default = 0];
301 enum ServerCrashState {
302 SERVER_CRASH_START = 1;
303 SERVER_CRASH_PROCESS_META = 2[deprecated=true];
304 SERVER_CRASH_GET_REGIONS = 3;
305 SERVER_CRASH_NO_SPLIT_LOGS = 4[deprecated=true];
306 SERVER_CRASH_SPLIT_LOGS = 5;
307 // Removed SERVER_CRASH_PREPARE_LOG_REPLAY = 6;
308 // Removed SERVER_CRASH_CALC_REGIONS_TO_ASSIGN = 7;
309 SERVER_CRASH_ASSIGN = 8;
310 SERVER_CRASH_WAIT_ON_ASSIGN = 9;
311 SERVER_CRASH_SPLIT_META_LOGS = 10;
312 SERVER_CRASH_ASSIGN_META = 11;
313 SERVER_CRASH_DELETE_SPLIT_META_WALS_DIR=12;
314 SERVER_CRASH_DELETE_SPLIT_WALS_DIR=13;
315 SERVER_CRASH_HANDLE_RIT2 = 20[deprecated=true];
316 SERVER_CRASH_FINISH = 100;
319 enum RecoverMetaState {
320 RECOVER_META_PREPARE = 0;
321 RECOVER_META_SPLIT_LOGS = 1;
322 RECOVER_META_ASSIGN_REGIONS = 2;
325 enum RegionTransitionState {
326 REGION_TRANSITION_QUEUE = 1;
327 REGION_TRANSITION_DISPATCH = 2;
328 REGION_TRANSITION_FINISH = 3;
331 message AssignRegionStateData {
332 required RegionTransitionState transition_state = 1;
333 required RegionInfo region_info = 2;
334 optional bool force_new_plan = 3 [default = false];
335 optional ServerName target_server = 4;
336 // Current attempt index used for expotential backoff when stuck
337 optional int32 attempt = 5;
340 message UnassignRegionStateData {
341 required RegionTransitionState transition_state = 1;
342 required RegionInfo region_info = 2;
343 // This is optional info; it is the servername we will
344 // subsequently assign the region too... it may be null.
345 optional ServerName destination_server = 3;
346 // This is the server currently hosting the Region, the
347 // server we will send the unassign rpc too.
348 optional ServerName hosting_server = 5;
349 optional bool force = 4 [default = false];
350 optional bool remove_after_unassigning = 6 [default = false];
351 // Current attempt index used for expotential backoff when stuck
352 optional int32 attempt = 7;
355 enum MoveRegionState {
356 MOVE_REGION_PREPARE = 0;
357 MOVE_REGION_UNASSIGN = 1;
358 MOVE_REGION_ASSIGN = 2;
361 message MoveRegionStateData {
362 optional RegionInfo region_info = 1;
363 required ServerName source_server = 2;
364 // if destination server not specified, its selected with load balancer
365 optional ServerName destination_server = 3;
369 GC_REGION_PREPARE = 1;
370 GC_REGION_ARCHIVE = 2;
371 GC_REGION_PURGE_METADATA = 3;
374 message GCRegionStateData {
375 required RegionInfo region_info = 1;
378 // NOTE: This message is used by GCMergedRegionStateProcedure
379 // AND GCMultipleMergedRegionStateProcedure.
380 enum GCMergedRegionsState {
381 GC_MERGED_REGIONS_PREPARE = 1;
382 GC_MERGED_REGIONS_PURGE = 2;
383 GC_REGION_EDIT_METADATA = 3;
386 message GCMergedRegionsStateData {
387 // Use GCMultipleMergedRegionsStateData instead.
388 option deprecated = true;
389 required RegionInfo parent_a = 1;
390 required RegionInfo parent_b = 2;
391 required RegionInfo merged_child = 3;
394 message GCMultipleMergedRegionsStateData {
395 repeated RegionInfo parents = 1;
396 required RegionInfo merged_child = 2;
399 enum PeerModificationState {
400 PRE_PEER_MODIFICATION = 1;
401 UPDATE_PEER_STORAGE = 2;
402 REFRESH_PEER_ON_RS = 3;
403 SERIAL_PEER_REOPEN_REGIONS = 4;
404 SERIAL_PEER_UPDATE_LAST_PUSHED_SEQ_ID = 5;
405 SERIAL_PEER_SET_PEER_ENABLED = 6;
406 SERIAL_PEER_ENABLE_PEER_REFRESH_PEER_ON_RS = 7;
407 POST_PEER_MODIFICATION = 8;
410 enum PeerSyncReplicationStateTransitionState {
411 PRE_PEER_SYNC_REPLICATION_STATE_TRANSITION = 1;
412 SET_PEER_NEW_SYNC_REPLICATION_STATE = 2;
413 REFRESH_PEER_SYNC_REPLICATION_STATE_ON_RS_BEGIN = 3;
414 REOPEN_ALL_REGIONS_IN_PEER = 4;
415 SYNC_REPLICATION_UPDATE_LAST_PUSHED_SEQ_ID_FOR_SERIAL_PEER = 5;
416 REPLAY_REMOTE_WAL_IN_PEER = 6;
417 REMOVE_ALL_REPLICATION_QUEUES_IN_PEER = 7;
418 TRANSIT_PEER_NEW_SYNC_REPLICATION_STATE = 8;
419 REFRESH_PEER_SYNC_REPLICATION_STATE_ON_RS_END = 9;
420 SYNC_REPLICATION_SET_PEER_ENABLED = 10;
421 SYNC_REPLICATION_ENABLE_PEER_REFRESH_PEER_ON_RS = 11;
422 CREATE_DIR_FOR_REMOTE_WAL = 12;
423 POST_PEER_SYNC_REPLICATION_STATE_TRANSITION = 13;
426 message PeerModificationStateData {
427 required string peer_id = 1;
430 enum PeerModificationType {
435 UPDATE_PEER_CONFIG = 5;
436 TRANSIT_SYNC_REPLICATION_STATE = 6;
439 message RefreshPeerStateData {
440 required string peer_id = 1;
441 required PeerModificationType type = 2;
442 required ServerName target_server = 3;
443 /** We need multiple stages for sync replication state transition **/
444 optional uint32 stage = 4 [default = 0];
447 message RefreshPeerParameter {
448 required string peer_id = 1;
449 required PeerModificationType type = 2;
450 required ServerName target_server = 3;
451 /** We need multiple stages for sync replication state transition **/
452 optional uint32 stage = 4 [default = 0];;
455 message PeerProcedureStateData {
456 required string peer_id = 1;
459 message AddPeerStateData {
460 required ReplicationPeer peer_config = 1;
461 required bool enabled = 2;
464 message UpdatePeerConfigStateData {
465 required ReplicationPeer peer_config = 1;
466 optional ReplicationPeer old_peer_config = 2;
467 required bool enabled = 3;
470 message RemovePeerStateData {
471 optional ReplicationPeer peer_config = 1;
474 message EnablePeerStateData {
477 message DisablePeerStateData {
480 enum ReopenTableRegionsState {
481 REOPEN_TABLE_REGIONS_GET_REGIONS = 1;
482 REOPEN_TABLE_REGIONS_REOPEN_REGIONS = 2;
483 REOPEN_TABLE_REGIONS_CONFIRM_REOPENED = 3;
486 message ReopenTableRegionsStateData {
487 required TableName table_name = 1;
488 repeated RegionLocation region = 2;
492 INIT_META_ASSIGN_META = 1;
493 INIT_META_CREATE_NAMESPACES = 2;
496 message InitMetaStateData {
499 message TransitPeerSyncReplicationStateStateData {
500 /** Could be null if we fail in pre check, so optional */
501 optional SyncReplicationState fromState = 1;
502 required SyncReplicationState toState = 2;
505 enum RecoverStandbyState {
506 RENAME_SYNC_REPLICATION_WALS_DIR = 1;
507 REGISTER_PEER_TO_WORKER_STORAGE = 2;
509 UNREGISTER_PEER_FROM_WORKER_STORAGE = 4;
510 SNAPSHOT_SYNC_REPLICATION_WALS_DIR = 5;
513 enum SyncReplicationReplayWALState {
515 DISPATCH_WALS_TO_WORKER = 2;
519 message RecoverStandbyStateData {
520 required bool serial = 1;
523 message SyncReplicationReplayWALStateData {
524 required string peer_id = 1;
525 repeated string wal = 2;
526 optional ServerName worker = 3;
529 message SyncReplicationReplayWALRemoteStateData {
530 required string peer_id = 1;
531 repeated string wal = 2;
532 required ServerName target_server = 3;
535 message ReplaySyncReplicationWALParameter {
536 required string peer_id = 1;
537 repeated string wal = 2;
540 enum RegionStateTransitionState {
541 REGION_STATE_TRANSITION_GET_ASSIGN_CANDIDATE = 1;
542 REGION_STATE_TRANSITION_OPEN = 2;
543 REGION_STATE_TRANSITION_CONFIRM_OPENED = 3;
544 REGION_STATE_TRANSITION_CLOSE = 4;
545 REGION_STATE_TRANSITION_CONFIRM_CLOSED = 5;
548 enum RegionTransitionType {
555 message RegionStateTransitionStateData {
556 required RegionTransitionType type = 1;
557 optional ServerName assign_candidate = 2;
558 required bool force_new_plan = 3;
561 enum RegionRemoteProcedureBaseState {
562 REGION_REMOTE_PROCEDURE_DISPATCH = 1;
563 REGION_REMOTE_PROCEDURE_REPORT_SUCCEED = 2;
564 REGION_REMOTE_PROCEDURE_DISPATCH_FAIL = 3;
565 REGION_REMOTE_PROCEDURE_SERVER_CRASH = 4;
568 message RegionRemoteProcedureBaseStateData {
569 required RegionInfo region = 1;
570 required ServerName target_server = 2;
571 required RegionRemoteProcedureBaseState state = 3;
572 optional RegionStateTransition.TransitionCode transition_code = 4;
573 optional int64 seq_id = 5;
576 message OpenRegionProcedureStateData {
579 message CloseRegionProcedureStateData {
580 optional ServerName assign_candidate = 1;
583 enum SwitchRpcThrottleState {
584 UPDATE_SWITCH_RPC_THROTTLE_STORAGE = 1;
585 SWITCH_RPC_THROTTLE_ON_RS = 2;
586 POST_SWITCH_RPC_THROTTLE = 3;
589 message SwitchRpcThrottleStateData {
590 required bool rpc_throttle_enabled = 1;
593 message SwitchRpcThrottleRemoteStateData {
594 required ServerName target_server = 1;
595 required bool rpc_throttle_enabled = 2;
598 message SplitWALParameter {
599 required string wal_path = 1;
603 message SplitWALData{
604 required string wal_path = 1;
605 required ServerName crashed_server=2;
606 optional ServerName worker = 3;
609 message SplitWALRemoteData{
610 required string wal_path = 1;
611 required ServerName crashed_server=2;
612 required ServerName worker = 3;
616 ACQUIRE_SPLIT_WAL_WORKER = 1;
617 DISPATCH_WAL_TO_WORKER = 2;
618 RELEASE_SPLIT_WORKER = 3;