ZooKeeper.proto 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /**
  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
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  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.
  17. */
  18. // ZNode data in hbase are serialized protobufs with a four byte
  19. // 'magic' 'PBUF' prefix.
  20. package pb;
  21. option java_package = "org.apache.hadoop.hbase.protobuf.generated";
  22. option java_outer_classname = "ZooKeeperProtos";
  23. option java_generic_services = true;
  24. option java_generate_equals_and_hash = true;
  25. option optimize_for = SPEED;
  26. import "HBase.proto";
  27. import "ClusterStatus.proto";
  28. /**
  29. * Content of the meta-region-server znode.
  30. */
  31. message MetaRegionServer {
  32. // The ServerName hosting the meta region currently, or destination server,
  33. // if meta region is in transition.
  34. required ServerName server = 1;
  35. // The major version of the rpc the server speaks. This is used so that
  36. // clients connecting to the cluster can have prior knowledge of what version
  37. // to send to a RegionServer. AsyncHBase will use this to detect versions.
  38. optional uint32 rpc_version = 2;
  39. // State of the region transition. OPEN means fully operational 'hbase:meta'
  40. optional RegionState.State state = 3;
  41. }
  42. /**
  43. * Content of the master znode.
  44. */
  45. message Master {
  46. // The ServerName of the current Master
  47. required ServerName master = 1;
  48. // Major RPC version so that clients can know what version the master can accept.
  49. optional uint32 rpc_version = 2;
  50. optional uint32 info_port = 3;
  51. }
  52. /**
  53. * Content of the '/hbase/running', cluster state, znode.
  54. */
  55. message ClusterUp {
  56. // If this znode is present, cluster is up. Currently
  57. // the data is cluster start_date.
  58. required string start_date = 1;
  59. }
  60. /**
  61. * What we write under unassigned up in zookeeper as a region moves through
  62. * open/close, etc., regions. Details a region in transition.
  63. */
  64. message RegionTransition {
  65. // Code for EventType gotten by doing o.a.h.h.EventHandler.EventType.getCode()
  66. required uint32 event_type_code = 1;
  67. // Full regionname in bytes
  68. required bytes region_name = 2;
  69. required uint64 create_time = 3;
  70. // The region server where the transition will happen or is happening
  71. required ServerName server_name = 4;
  72. optional bytes payload = 5;
  73. }
  74. /**
  75. * WAL SplitLog directory znodes have this for content. Used doing distributed
  76. * WAL splitting. Holds current state and name of server that originated split.
  77. */
  78. message SplitLogTask {
  79. enum State {
  80. UNASSIGNED = 0;
  81. OWNED = 1;
  82. RESIGNED = 2;
  83. DONE = 3;
  84. ERR = 4;
  85. }
  86. enum RecoveryMode {
  87. UNKNOWN = 0;
  88. LOG_SPLITTING = 1;
  89. LOG_REPLAY = 2;
  90. }
  91. required State state = 1;
  92. required ServerName server_name = 2;
  93. optional RecoveryMode mode = 3 [default = UNKNOWN];
  94. }
  95. /**
  96. * The znode that holds state of table.
  97. */
  98. message Table {
  99. // Table's current state
  100. enum State {
  101. ENABLED = 0;
  102. DISABLED = 1;
  103. DISABLING = 2;
  104. ENABLING = 3;
  105. }
  106. // This is the table's state. If no znode for a table,
  107. // its state is presumed enabled. See o.a.h.h.zookeeper.ZKTable class
  108. // for more.
  109. required State state = 1 [default = ENABLED];
  110. }
  111. /**
  112. * Used by replication. Holds a replication peer key.
  113. */
  114. message ReplicationPeer {
  115. // clusterkey is the concatenation of the slave cluster's
  116. // hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent
  117. required string clusterkey = 1;
  118. optional string replicationEndpointImpl = 2;
  119. repeated BytesBytesPair data = 3;
  120. repeated NameStringPair configuration = 4;
  121. }
  122. /**
  123. * Used by replication. Holds whether enabled or disabled
  124. */
  125. message ReplicationState {
  126. enum State {
  127. ENABLED = 0;
  128. DISABLED = 1;
  129. }
  130. required State state = 1;
  131. }
  132. /**
  133. * Used by replication. Holds the current position in an WAL file.
  134. */
  135. message ReplicationHLogPosition {
  136. required int64 position = 1;
  137. }
  138. /**
  139. * Used by replication. Used to lock a region server during failover.
  140. */
  141. message ReplicationLock {
  142. required string lock_owner = 1;
  143. }
  144. /**
  145. * Metadata associated with a table lock in zookeeper
  146. */
  147. message TableLock {
  148. optional TableName table_name = 1;
  149. optional ServerName lock_owner = 2;
  150. optional int64 thread_id = 3;
  151. optional bool is_shared = 4;
  152. optional string purpose = 5;
  153. optional int64 create_time = 6;
  154. }
  155. /**
  156. * State of the switch.
  157. */
  158. message SwitchState {
  159. optional bool enabled = 1;
  160. }