QJournalProtocol.proto 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. /**
  19. * These .proto interfaces are private and stable.
  20. * Please see http://wiki.apache.org/hadoop/Compatibility
  21. * for what changes are allowed for a *stable* .proto interface.
  22. */
  23. option java_package = "org.apache.hadoop.hdfs.qjournal.protocol";
  24. option java_outer_classname = "QJournalProtocolProtos";
  25. option java_generic_services = true;
  26. option java_generate_equals_and_hash = true;
  27. package hadoop.hdfs;
  28. import "hdfs.proto";
  29. message JournalIdProto {
  30. required string identifier = 1;
  31. }
  32. message RequestInfoProto {
  33. required JournalIdProto journalId = 1;
  34. required uint64 epoch = 2;
  35. required uint64 ipcSerialNumber = 3;
  36. // Whenever a writer makes a request, it informs
  37. // the node of the latest committed txid. This may
  38. // be higher than the transaction data included in the
  39. // request itself, eg in the case that the node has
  40. // fallen behind.
  41. optional uint64 committedTxId = 4;
  42. }
  43. message SegmentStateProto {
  44. required uint64 startTxId = 1;
  45. required uint64 endTxId = 2;
  46. required bool isInProgress = 3;
  47. }
  48. /**
  49. * The storage format used on local disk for previously
  50. * accepted decisions.
  51. */
  52. message PersistedRecoveryPaxosData {
  53. required SegmentStateProto segmentState = 1;
  54. required uint64 acceptedInEpoch = 2;
  55. }
  56. /**
  57. * journal()
  58. */
  59. message JournalRequestProto {
  60. required RequestInfoProto reqInfo = 1;
  61. required uint64 firstTxnId = 2;
  62. required uint32 numTxns = 3;
  63. required bytes records = 4;
  64. required uint64 segmentTxnId = 5;
  65. }
  66. message JournalResponseProto {
  67. }
  68. /**
  69. * heartbeat()
  70. */
  71. message HeartbeatRequestProto {
  72. required RequestInfoProto reqInfo = 1;
  73. }
  74. message HeartbeatResponseProto { // void response
  75. }
  76. /**
  77. * startLogSegment()
  78. */
  79. message StartLogSegmentRequestProto {
  80. required RequestInfoProto reqInfo = 1;
  81. required uint64 txid = 2; // Transaction ID
  82. }
  83. message StartLogSegmentResponseProto {
  84. }
  85. /**
  86. * finalizeLogSegment()
  87. */
  88. message FinalizeLogSegmentRequestProto {
  89. required RequestInfoProto reqInfo = 1;
  90. required uint64 startTxId = 2;
  91. required uint64 endTxId = 3;
  92. }
  93. message FinalizeLogSegmentResponseProto {
  94. }
  95. /**
  96. * purgeLogs()
  97. */
  98. message PurgeLogsRequestProto {
  99. required RequestInfoProto reqInfo = 1;
  100. required uint64 minTxIdToKeep = 2;
  101. }
  102. message PurgeLogsResponseProto {
  103. }
  104. /**
  105. * isFormatted()
  106. */
  107. message IsFormattedRequestProto {
  108. required JournalIdProto jid = 1;
  109. }
  110. message IsFormattedResponseProto {
  111. required bool isFormatted = 1;
  112. }
  113. /**
  114. * getJournalState()
  115. */
  116. message GetJournalStateRequestProto {
  117. required JournalIdProto jid = 1;
  118. }
  119. message GetJournalStateResponseProto {
  120. required uint64 lastPromisedEpoch = 1;
  121. // Deprecated by fromURL
  122. required uint32 httpPort = 2;
  123. optional string fromURL = 3;
  124. }
  125. /**
  126. * format()
  127. */
  128. message FormatRequestProto {
  129. required JournalIdProto jid = 1;
  130. required NamespaceInfoProto nsInfo = 2;
  131. }
  132. message FormatResponseProto {
  133. }
  134. /**
  135. * newEpoch()
  136. */
  137. message NewEpochRequestProto {
  138. required JournalIdProto jid = 1;
  139. required NamespaceInfoProto nsInfo = 2;
  140. required uint64 epoch = 3;
  141. }
  142. message NewEpochResponseProto {
  143. optional uint64 lastSegmentTxId = 1;
  144. }
  145. /**
  146. * getEditLogManifest()
  147. */
  148. message GetEditLogManifestRequestProto {
  149. required JournalIdProto jid = 1;
  150. required uint64 sinceTxId = 2; // Transaction ID
  151. // Whether or not the client will be reading from the returned streams.
  152. // optional bool forReading = 3 [default = true]; <obsolete, do not reuse>
  153. optional bool inProgressOk = 4 [default = false];
  154. }
  155. message GetEditLogManifestResponseProto {
  156. required RemoteEditLogManifestProto manifest = 1;
  157. // Deprecated by fromURL
  158. required uint32 httpPort = 2;
  159. optional string fromURL = 3;
  160. // TODO: we should add nsinfo somewhere
  161. // to verify that it matches up with our expectation
  162. // required NamespaceInfoProto nsInfo = 2;
  163. }
  164. /**
  165. * prepareRecovery()
  166. */
  167. message PrepareRecoveryRequestProto {
  168. required RequestInfoProto reqInfo = 1;
  169. required uint64 segmentTxId = 2;
  170. }
  171. message PrepareRecoveryResponseProto {
  172. optional SegmentStateProto segmentState = 1;
  173. optional uint64 acceptedInEpoch = 2;
  174. required uint64 lastWriterEpoch = 3;
  175. // The highest committed txid that this logger has ever seen.
  176. // This may be higher than the data it actually has, in the case
  177. // that it was lagging before the old writer crashed.
  178. optional uint64 lastCommittedTxId = 4;
  179. }
  180. /**
  181. * acceptRecovery()
  182. */
  183. message AcceptRecoveryRequestProto {
  184. required RequestInfoProto reqInfo = 1;
  185. /** Details on the segment to recover */
  186. required SegmentStateProto stateToAccept = 2;
  187. /** The URL from which the log may be copied */
  188. required string fromURL = 3;
  189. }
  190. message AcceptRecoveryResponseProto {
  191. }
  192. /**
  193. * Protocol used to journal edits to a JournalNode.
  194. * See the request and response for details of rpc call.
  195. */
  196. service QJournalProtocolService {
  197. rpc isFormatted(IsFormattedRequestProto) returns (IsFormattedResponseProto);
  198. rpc getJournalState(GetJournalStateRequestProto) returns (GetJournalStateResponseProto);
  199. rpc newEpoch(NewEpochRequestProto) returns (NewEpochResponseProto);
  200. rpc format(FormatRequestProto) returns (FormatResponseProto);
  201. rpc journal(JournalRequestProto) returns (JournalResponseProto);
  202. rpc heartbeat(HeartbeatRequestProto) returns (HeartbeatResponseProto);
  203. rpc startLogSegment(StartLogSegmentRequestProto)
  204. returns (StartLogSegmentResponseProto);
  205. rpc finalizeLogSegment(FinalizeLogSegmentRequestProto)
  206. returns (FinalizeLogSegmentResponseProto);
  207. rpc purgeLogs(PurgeLogsRequestProto)
  208. returns (PurgeLogsResponseProto);
  209. rpc getEditLogManifest(GetEditLogManifestRequestProto)
  210. returns (GetEditLogManifestResponseProto);
  211. rpc prepareRecovery(PrepareRecoveryRequestProto)
  212. returns (PrepareRecoveryResponseProto);
  213. rpc acceptRecovery(AcceptRecoveryRequestProto)
  214. returns (AcceptRecoveryResponseProto);
  215. }