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";
32 // ============================================================================
33 // WARNING - Compatibility rules
34 // ============================================================================
35 // This .proto contains the data serialized by the master procedures.
36 // Each procedure has some state stored to know, which step were executed
37 // and what were the parameters or data created by the previous steps.
38 // new code should be able to handle the old format or at least fail cleanly
39 // triggering a rollback/cleanup.
41 // Procedures that are inheriting from a StateMachineProcedure have an enum:
42 // - Do not change the number of the 'State' enums.
43 // doing so, will cause executing the wrong 'step' on the pending
44 // procedures when they will be replayed.
45 // - Do not remove items from the enum, new code must be able to handle
46 // all the previous 'steps'. There may be pending procedure ready to be
47 // recovered replayed. alternative you can make sure that not-known state
48 // will result in a failure that will rollback the already executed steps.
49 // ============================================================================
51 enum CreateTableState {
52 CREATE_TABLE_PRE_OPERATION = 1;
53 CREATE_TABLE_WRITE_FS_LAYOUT = 2;
54 CREATE_TABLE_ADD_TO_META = 3;
55 CREATE_TABLE_ASSIGN_REGIONS = 4;
56 CREATE_TABLE_UPDATE_DESC_CACHE = 5;
57 CREATE_TABLE_POST_OPERATION = 6;
60 message CreateTableStateData {
61 required UserInformation user_info = 1;
62 required TableSchema table_schema = 2;
63 repeated RegionInfo region_info = 3;
66 enum ModifyTableState {
67 MODIFY_TABLE_PREPARE = 1;
68 MODIFY_TABLE_PRE_OPERATION = 2;
69 MODIFY_TABLE_UPDATE_TABLE_DESCRIPTOR = 3;
70 MODIFY_TABLE_REMOVE_REPLICA_COLUMN = 4;
71 MODIFY_TABLE_DELETE_FS_LAYOUT = 5;
72 MODIFY_TABLE_POST_OPERATION = 6;
73 MODIFY_TABLE_REOPEN_ALL_REGIONS = 7;
76 message ModifyTableStateData {
77 required UserInformation user_info = 1;
78 optional TableSchema unmodified_table_schema = 2;
79 required TableSchema modified_table_schema = 3;
80 required bool delete_column_family_in_modify = 4;
83 enum TruncateTableState {
84 TRUNCATE_TABLE_PRE_OPERATION = 1;
85 TRUNCATE_TABLE_REMOVE_FROM_META = 2;
86 TRUNCATE_TABLE_CLEAR_FS_LAYOUT = 3;
87 TRUNCATE_TABLE_CREATE_FS_LAYOUT = 4;
88 TRUNCATE_TABLE_ADD_TO_META = 5;
89 TRUNCATE_TABLE_ASSIGN_REGIONS = 6;
90 TRUNCATE_TABLE_POST_OPERATION = 7;
93 message TruncateTableStateData {
94 required UserInformation user_info = 1;
95 required bool preserve_splits = 2;
96 optional TableName table_name = 3;
97 optional TableSchema table_schema = 4;
98 repeated RegionInfo region_info = 5;
101 enum DeleteTableState {
102 DELETE_TABLE_PRE_OPERATION = 1;
103 DELETE_TABLE_REMOVE_FROM_META = 2;
104 DELETE_TABLE_CLEAR_FS_LAYOUT = 3;
105 DELETE_TABLE_UPDATE_DESC_CACHE = 4;
106 DELETE_TABLE_UNASSIGN_REGIONS = 5;
107 DELETE_TABLE_POST_OPERATION = 6;
110 message DeleteTableStateData {
111 required UserInformation user_info = 1;
112 required TableName table_name = 2;
113 repeated RegionInfo region_info = 3;
116 enum CreateNamespaceState {
117 CREATE_NAMESPACE_PREPARE = 1;
118 CREATE_NAMESPACE_CREATE_DIRECTORY = 2;
119 CREATE_NAMESPACE_INSERT_INTO_NS_TABLE = 3;
120 CREATE_NAMESPACE_UPDATE_ZK = 4;
121 CREATE_NAMESPACE_SET_NAMESPACE_QUOTA = 5;
124 message CreateNamespaceStateData {
125 required NamespaceDescriptor namespace_descriptor = 1;
128 enum ModifyNamespaceState {
129 MODIFY_NAMESPACE_PREPARE = 1;
130 MODIFY_NAMESPACE_UPDATE_NS_TABLE = 2;
131 MODIFY_NAMESPACE_UPDATE_ZK = 3;
134 message ModifyNamespaceStateData {
135 required NamespaceDescriptor namespace_descriptor = 1;
136 optional NamespaceDescriptor unmodified_namespace_descriptor = 2;
139 enum DeleteNamespaceState {
140 DELETE_NAMESPACE_PREPARE = 1;
141 DELETE_NAMESPACE_DELETE_FROM_NS_TABLE = 2;
142 DELETE_NAMESPACE_REMOVE_FROM_ZK = 3;
143 DELETE_NAMESPACE_DELETE_DIRECTORIES = 4;
144 DELETE_NAMESPACE_REMOVE_NAMESPACE_QUOTA = 5;
147 message DeleteNamespaceStateData {
148 required string namespace_name = 1;
149 optional NamespaceDescriptor namespace_descriptor = 2;
152 enum EnableTableState {
153 ENABLE_TABLE_PREPARE = 1;
154 ENABLE_TABLE_PRE_OPERATION = 2;
155 ENABLE_TABLE_SET_ENABLING_TABLE_STATE = 3;
156 ENABLE_TABLE_MARK_REGIONS_ONLINE = 4;
157 ENABLE_TABLE_SET_ENABLED_TABLE_STATE = 5;
158 ENABLE_TABLE_POST_OPERATION = 6;
161 message EnableTableStateData {
162 required UserInformation user_info = 1;
163 required TableName table_name = 2;
164 required bool skip_table_state_check = 3;
167 enum DisableTableState {
168 DISABLE_TABLE_PREPARE = 1;
169 DISABLE_TABLE_PRE_OPERATION = 2;
170 DISABLE_TABLE_SET_DISABLING_TABLE_STATE = 3;
171 DISABLE_TABLE_MARK_REGIONS_OFFLINE = 4;
172 DISABLE_TABLE_SET_DISABLED_TABLE_STATE = 5;
173 DISABLE_TABLE_POST_OPERATION = 6;
174 DISABLE_TABLE_ADD_REPLICATION_BARRIER = 7;
177 message DisableTableStateData {
178 required UserInformation user_info = 1;
179 required TableName table_name = 2;
180 required bool skip_table_state_check = 3;
183 message RestoreParentToChildRegionsPair {
184 required string parent_region_name = 1;
185 required string child1_region_name = 2;
186 required string child2_region_name = 3;
189 enum CloneSnapshotState {
190 CLONE_SNAPSHOT_PRE_OPERATION = 1;
191 CLONE_SNAPSHOT_WRITE_FS_LAYOUT = 2;
192 CLONE_SNAPSHOT_ADD_TO_META = 3;
193 CLONE_SNAPSHOT_ASSIGN_REGIONS = 4;
194 CLONE_SNAPSHOT_UPDATE_DESC_CACHE = 5;
195 CLONE_SNAPSHOT_POST_OPERATION = 6;
196 CLONE_SNAPHOST_RESTORE_ACL = 7;
199 message CloneSnapshotStateData {
200 required UserInformation user_info = 1;
201 required SnapshotDescription snapshot = 2;
202 required TableSchema table_schema = 3;
203 repeated RegionInfo region_info = 4;
204 repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 5;
207 enum RestoreSnapshotState {
208 RESTORE_SNAPSHOT_PRE_OPERATION = 1;
209 RESTORE_SNAPSHOT_UPDATE_TABLE_DESCRIPTOR = 2;
210 RESTORE_SNAPSHOT_WRITE_FS_LAYOUT = 3;
211 RESTORE_SNAPSHOT_UPDATE_META = 4;
212 RESTORE_SNAPSHOT_RESTORE_ACL = 5;
215 message RestoreSnapshotStateData {
216 required UserInformation user_info = 1;
217 required SnapshotDescription snapshot = 2;
218 required TableSchema modified_table_schema = 3;
219 repeated RegionInfo region_info_for_restore = 4;
220 repeated RegionInfo region_info_for_remove = 5;
221 repeated RegionInfo region_info_for_add = 6;
222 repeated RestoreParentToChildRegionsPair parent_to_child_regions_pair_list = 7;
225 enum DispatchMergingRegionsState {
226 DISPATCH_MERGING_REGIONS_PREPARE = 1;
227 DISPATCH_MERGING_REGIONS_PRE_OPERATION = 2;
228 DISPATCH_MERGING_REGIONS_MOVE_REGION_TO_SAME_RS = 3;
229 DISPATCH_MERGING_REGIONS_DO_MERGE_IN_RS = 4;
230 DISPATCH_MERGING_REGIONS_POST_OPERATION = 5;
233 message DispatchMergingRegionsStateData {
234 required UserInformation user_info = 1;
235 required TableName table_name = 2;
236 repeated RegionInfo region_info = 3;
237 optional bool forcible = 4;
240 enum SplitTableRegionState {
241 SPLIT_TABLE_REGION_PREPARE = 1;
242 SPLIT_TABLE_REGION_PRE_OPERATION = 2;
243 SPLIT_TABLE_REGION_CLOSE_PARENT_REGION = 3;
244 SPLIT_TABLE_REGION_CREATE_DAUGHTER_REGIONS = 4;
245 SPLIT_TABLE_REGION_WRITE_MAX_SEQUENCE_ID_FILE = 5;
246 SPLIT_TABLE_REGION_PRE_OPERATION_BEFORE_META = 6;
247 SPLIT_TABLE_REGION_UPDATE_META = 7;
248 SPLIT_TABLE_REGION_PRE_OPERATION_AFTER_META = 8;
249 SPLIT_TABLE_REGION_OPEN_CHILD_REGIONS = 9;
250 SPLIT_TABLE_REGION_POST_OPERATION = 10;
253 message SplitTableRegionStateData {
254 required UserInformation user_info = 1;
255 required RegionInfo parent_region_info = 2;
256 repeated RegionInfo child_region_info = 3;
259 enum MergeTableRegionsState {
260 MERGE_TABLE_REGIONS_PREPARE = 1;
261 MERGE_TABLE_REGIONS_PRE_OPERATION = 2;
262 MERGE_TABLE_REGIONS_PRE_MERGE_OPERATION = 3;
263 MERGE_TABLE_REGIONS_CLOSE_REGIONS = 4;
264 MERGE_TABLE_REGIONS_CREATE_MERGED_REGION = 5;
265 MERGE_TABLE_REGIONS_WRITE_MAX_SEQUENCE_ID_FILE = 6;
266 MERGE_TABLE_REGIONS_PRE_MERGE_COMMIT_OPERATION = 7;
267 MERGE_TABLE_REGIONS_UPDATE_META = 8;
268 MERGE_TABLE_REGIONS_POST_MERGE_COMMIT_OPERATION = 9;
269 MERGE_TABLE_REGIONS_OPEN_MERGED_REGION = 10;
270 MERGE_TABLE_REGIONS_POST_OPERATION = 11;
273 message MergeTableRegionsStateData {
274 required UserInformation user_info = 1;
275 repeated RegionInfo region_info = 2;
276 optional RegionInfo merged_region_info = 3;
277 optional bool forcible = 4 [default = false];
281 message ServerCrashStateData {
282 required ServerName server_name = 1;
283 // optional bool DEPRECATED_distributed_log_replay = 2;
284 repeated RegionInfo regions_on_crashed_server = 3;
285 repeated RegionInfo regions_assigned = 4;
286 optional bool carrying_meta = 5;
287 optional bool should_split_wal = 6 [default = true];
290 message RecoverMetaStateData {
291 optional ServerName failed_meta_server = 1;
292 optional bool should_split_wal = 2 [default = true];
293 optional int32 replica_id = 3 [default = 0];
296 enum ServerCrashState {
297 SERVER_CRASH_START = 1;
298 SERVER_CRASH_PROCESS_META = 2[deprecated=true];
299 SERVER_CRASH_GET_REGIONS = 3;
300 SERVER_CRASH_NO_SPLIT_LOGS = 4[deprecated=true];
301 SERVER_CRASH_SPLIT_LOGS = 5;
302 // Removed SERVER_CRASH_PREPARE_LOG_REPLAY = 6;
303 // Removed SERVER_CRASH_CALC_REGIONS_TO_ASSIGN = 7;
304 SERVER_CRASH_ASSIGN = 8;
305 SERVER_CRASH_WAIT_ON_ASSIGN = 9;
306 SERVER_CRASH_SPLIT_META_LOGS = 10;
307 SERVER_CRASH_ASSIGN_META = 11;
308 SERVER_CRASH_HANDLE_RIT2 = 20[deprecated=true];
309 SERVER_CRASH_FINISH = 100;
312 enum RecoverMetaState {
313 RECOVER_META_PREPARE = 0;
314 RECOVER_META_SPLIT_LOGS = 1;
315 RECOVER_META_ASSIGN_REGIONS = 2;
318 enum RegionTransitionState {
319 REGION_TRANSITION_QUEUE = 1;
320 REGION_TRANSITION_DISPATCH = 2;
321 REGION_TRANSITION_FINISH = 3;
324 message AssignRegionStateData {
325 required RegionTransitionState transition_state = 1;
326 required RegionInfo region_info = 2;
327 optional bool force_new_plan = 3 [default = false];
328 optional ServerName target_server = 4;
329 // Current attempt index used for expotential backoff when stuck
330 optional int32 attempt = 5;
333 message UnassignRegionStateData {
334 required RegionTransitionState transition_state = 1;
335 required RegionInfo region_info = 2;
336 // This is optional info; it is the servername we will
337 // subsequently assign the region too... it may be null.
338 optional ServerName destination_server = 3;
339 // This is the server currently hosting the Region, the
340 // server we will send the unassign rpc too.
341 optional ServerName hosting_server = 5;
342 optional bool force = 4 [default = false];
343 optional bool remove_after_unassigning = 6 [default = false];
344 // Current attempt index used for expotential backoff when stuck
345 optional int32 attempt = 7;
348 enum MoveRegionState {
349 MOVE_REGION_PREPARE = 0;
350 MOVE_REGION_UNASSIGN = 1;
351 MOVE_REGION_ASSIGN = 2;
354 message MoveRegionStateData {
355 optional RegionInfo region_info = 1;
356 required ServerName source_server = 2;
357 // if destination server not specified, its selected with load balancer
358 optional ServerName destination_server = 3;
362 GC_REGION_PREPARE = 1;
363 GC_REGION_ARCHIVE = 2;
364 GC_REGION_PURGE_METADATA = 3;
367 message GCRegionStateData {
368 required RegionInfo region_info = 1;
371 enum GCMergedRegionsState {
372 GC_MERGED_REGIONS_PREPARE = 1;
373 GC_MERGED_REGIONS_PURGE = 2;
374 GC_REGION_EDIT_METADATA = 3;
377 message GCMergedRegionsStateData {
378 required RegionInfo parent_a = 1;
379 required RegionInfo parent_b = 2;
380 required RegionInfo merged_child = 3;
383 enum PeerModificationState {
384 PRE_PEER_MODIFICATION = 1;
385 UPDATE_PEER_STORAGE = 2;
386 REFRESH_PEER_ON_RS = 3;
387 SERIAL_PEER_REOPEN_REGIONS = 4;
388 SERIAL_PEER_UPDATE_LAST_PUSHED_SEQ_ID = 5;
389 SERIAL_PEER_SET_PEER_ENABLED = 6;
390 SERIAL_PEER_ENABLE_PEER_REFRESH_PEER_ON_RS = 7;
391 POST_PEER_MODIFICATION = 8;
394 enum PeerSyncReplicationStateTransitionState {
395 PRE_PEER_SYNC_REPLICATION_STATE_TRANSITION = 1;
396 SET_PEER_NEW_SYNC_REPLICATION_STATE = 2;
397 REFRESH_PEER_SYNC_REPLICATION_STATE_ON_RS_BEGIN = 3;
398 REPLAY_REMOTE_WAL_IN_PEER = 4;
399 REMOVE_ALL_REPLICATION_QUEUES_IN_PEER = 5;
400 REOPEN_ALL_REGIONS_IN_PEER = 6;
401 TRANSIT_PEER_NEW_SYNC_REPLICATION_STATE = 7;
402 REFRESH_PEER_SYNC_REPLICATION_STATE_ON_RS_END = 8;
403 SYNC_REPLICATION_SET_PEER_ENABLED = 9;
404 SYNC_REPLICATION_ENABLE_PEER_REFRESH_PEER_ON_RS = 10;
405 CREATE_DIR_FOR_REMOTE_WAL = 11;
406 POST_PEER_SYNC_REPLICATION_STATE_TRANSITION = 12;
409 message PeerModificationStateData {
410 required string peer_id = 1;
413 enum PeerModificationType {
418 UPDATE_PEER_CONFIG = 5;
419 TRANSIT_SYNC_REPLICATION_STATE = 6;
422 message RefreshPeerStateData {
423 required string peer_id = 1;
424 required PeerModificationType type = 2;
425 required ServerName target_server = 3;
426 /** We need multiple stages for sync replication state transition **/
427 optional uint32 stage = 4 [default = 0];
430 message RefreshPeerParameter {
431 required string peer_id = 1;
432 required PeerModificationType type = 2;
433 required ServerName target_server = 3;
434 /** We need multiple stages for sync replication state transition **/
435 optional uint32 stage = 4 [default = 0];;
438 message PeerProcedureStateData {
439 required string peer_id = 1;
442 message AddPeerStateData {
443 required ReplicationPeer peer_config = 1;
444 required bool enabled = 2;
447 message UpdatePeerConfigStateData {
448 required ReplicationPeer peer_config = 1;
449 optional ReplicationPeer old_peer_config = 2;
450 required bool enabled = 3;
453 message RemovePeerStateData {
454 optional ReplicationPeer peer_config = 1;
457 message EnablePeerStateData {
460 message DisablePeerStateData {
463 enum ReopenTableRegionsState {
464 REOPEN_TABLE_REGIONS_GET_REGIONS = 1;
465 REOPEN_TABLE_REGIONS_REOPEN_REGIONS = 2;
466 REOPEN_TABLE_REGIONS_CONFIRM_REOPENED = 3;
469 message ReopenTableRegionsStateData {
470 required TableName table_name = 1;
471 repeated RegionLocation region = 2;
475 INIT_META_ASSIGN_META = 1;
478 message InitMetaStateData {
481 message TransitPeerSyncReplicationStateStateData {
482 /** Could be null if we fail in pre check, so optional */
483 optional SyncReplicationState fromState = 1;
484 required SyncReplicationState toState = 2;
487 enum RecoverStandbyState {
488 RENAME_SYNC_REPLICATION_WALS_DIR = 1;
491 REMOVE_SYNC_REPLICATION_WALS_DIR = 4;
494 message RecoverStandbyStateData {
495 required string peer_id = 1;
498 message ReplaySyncReplicationWALStateData {
499 required string peer_id = 1;
500 required string wal = 2;
501 optional ServerName target_server = 3;
504 message ReplaySyncReplicationWALParameter {
505 required string peer_id = 1;
506 required string wal = 2;