QJournalProtocol.proto 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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.qjournal;
  28. import "hdfs.proto";
  29. import "HdfsServer.proto";
  30. message JournalIdProto {
  31. required string identifier = 1;
  32. }
  33. message RequestInfoProto {
  34. required JournalIdProto journalId = 1;
  35. required uint64 epoch = 2;
  36. required uint64 ipcSerialNumber = 3;
  37. // Whenever a writer makes a request, it informs
  38. // the node of the latest committed txid. This may
  39. // be higher than the transaction data included in the
  40. // request itself, eg in the case that the node has
  41. // fallen behind.
  42. optional uint64 committedTxId = 4;
  43. optional string nameServiceId = 5;
  44. }
  45. message SegmentStateProto {
  46. required uint64 startTxId = 1;
  47. required uint64 endTxId = 2;
  48. required bool isInProgress = 3;
  49. }
  50. /**
  51. * The storage format used on local disk for previously
  52. * accepted decisions.
  53. */
  54. message PersistedRecoveryPaxosData {
  55. required SegmentStateProto segmentState = 1;
  56. required uint64 acceptedInEpoch = 2;
  57. }
  58. /**
  59. * journal()
  60. */
  61. message JournalRequestProto {
  62. required RequestInfoProto reqInfo = 1;
  63. required uint64 firstTxnId = 2;
  64. required uint32 numTxns = 3;
  65. required bytes records = 4;
  66. required uint64 segmentTxnId = 5;
  67. optional string nameServiceId = 6;
  68. }
  69. message JournalResponseProto {
  70. }
  71. /**
  72. * heartbeat()
  73. */
  74. message HeartbeatRequestProto {
  75. required RequestInfoProto reqInfo = 1;
  76. }
  77. message HeartbeatResponseProto { // void response
  78. }
  79. /**
  80. * startLogSegment()
  81. */
  82. message StartLogSegmentRequestProto {
  83. required RequestInfoProto reqInfo = 1;
  84. required uint64 txid = 2; // Transaction ID
  85. optional sint32 layoutVersion = 3; // the LayoutVersion in the client
  86. }
  87. message StartLogSegmentResponseProto {
  88. }
  89. /**
  90. * finalizeLogSegment()
  91. */
  92. message FinalizeLogSegmentRequestProto {
  93. required RequestInfoProto reqInfo = 1;
  94. required uint64 startTxId = 2;
  95. required uint64 endTxId = 3;
  96. }
  97. message FinalizeLogSegmentResponseProto {
  98. }
  99. /**
  100. * purgeLogs()
  101. */
  102. message PurgeLogsRequestProto {
  103. required RequestInfoProto reqInfo = 1;
  104. required uint64 minTxIdToKeep = 2;
  105. }
  106. message PurgeLogsResponseProto {
  107. }
  108. /**
  109. * isFormatted()
  110. */
  111. message IsFormattedRequestProto {
  112. required JournalIdProto jid = 1;
  113. optional string nameServiceId = 2;
  114. }
  115. message IsFormattedResponseProto {
  116. required bool isFormatted = 1;
  117. }
  118. /**
  119. * getJournalCTime()
  120. */
  121. message GetJournalCTimeRequestProto {
  122. required JournalIdProto jid = 1;
  123. optional string nameServiceId = 2;
  124. }
  125. message GetJournalCTimeResponseProto {
  126. required int64 resultCTime = 1;
  127. }
  128. /**
  129. * doPreUpgrade()
  130. */
  131. message DoPreUpgradeRequestProto {
  132. required JournalIdProto jid = 1;
  133. }
  134. message DoPreUpgradeResponseProto {
  135. }
  136. /**
  137. * doUpgrade()
  138. */
  139. message DoUpgradeRequestProto {
  140. required JournalIdProto jid = 1;
  141. required StorageInfoProto sInfo = 2;
  142. }
  143. message DoUpgradeResponseProto {
  144. }
  145. /**
  146. * doFinalize()
  147. */
  148. message DoFinalizeRequestProto {
  149. required JournalIdProto jid = 1;
  150. optional string nameServiceId = 2;
  151. }
  152. message DoFinalizeResponseProto {
  153. }
  154. /**
  155. * canRollBack()
  156. */
  157. message CanRollBackRequestProto {
  158. required JournalIdProto jid = 1;
  159. required StorageInfoProto storage = 2;
  160. required StorageInfoProto prevStorage = 3;
  161. required int32 targetLayoutVersion = 4;
  162. optional string nameServiceId = 5;
  163. }
  164. message CanRollBackResponseProto {
  165. required bool canRollBack = 1;
  166. }
  167. /**
  168. * doRollback()
  169. */
  170. message DoRollbackRequestProto {
  171. required JournalIdProto jid = 1;
  172. optional string nameserviceId = 2;
  173. }
  174. message DoRollbackResponseProto {
  175. }
  176. /**
  177. * discardSegments()
  178. */
  179. message DiscardSegmentsRequestProto {
  180. required JournalIdProto jid = 1;
  181. required uint64 startTxId = 2;
  182. optional string nameServiceId = 3;
  183. }
  184. message DiscardSegmentsResponseProto {
  185. }
  186. /**
  187. * getJournalState()
  188. */
  189. message GetJournalStateRequestProto {
  190. required JournalIdProto jid = 1;
  191. optional string nameServiceId = 2;
  192. }
  193. message GetJournalStateResponseProto {
  194. required uint64 lastPromisedEpoch = 1;
  195. // Deprecated by fromURL
  196. required uint32 httpPort = 2;
  197. optional string fromURL = 3;
  198. }
  199. /**
  200. * format()
  201. */
  202. message FormatRequestProto {
  203. required JournalIdProto jid = 1;
  204. required NamespaceInfoProto nsInfo = 2;
  205. optional string nameServiceId = 3;
  206. }
  207. message FormatResponseProto {
  208. }
  209. /**
  210. * newEpoch()
  211. */
  212. message NewEpochRequestProto {
  213. required JournalIdProto jid = 1;
  214. required NamespaceInfoProto nsInfo = 2;
  215. required uint64 epoch = 3;
  216. optional string nameServiceId = 4;
  217. }
  218. message NewEpochResponseProto {
  219. optional uint64 lastSegmentTxId = 1;
  220. }
  221. /**
  222. * getEditLogManifest()
  223. */
  224. message GetEditLogManifestRequestProto {
  225. required JournalIdProto jid = 1;
  226. required uint64 sinceTxId = 2; // Transaction ID
  227. // Whether or not the client will be reading from the returned streams.
  228. // optional bool forReading = 3 [default = true]; <obsolete, do not reuse>
  229. optional bool inProgressOk = 4 [default = false];
  230. optional string nameServiceId = 5;
  231. }
  232. message GetEditLogManifestResponseProto {
  233. required RemoteEditLogManifestProto manifest = 1;
  234. // Deprecated by fromURL
  235. required uint32 httpPort = 2;
  236. optional string fromURL = 3;
  237. // TODO: we should add nsinfo somewhere
  238. // to verify that it matches up with our expectation
  239. // required NamespaceInfoProto nsInfo = 2;
  240. }
  241. /**
  242. * prepareRecovery()
  243. */
  244. message PrepareRecoveryRequestProto {
  245. required RequestInfoProto reqInfo = 1;
  246. required uint64 segmentTxId = 2;
  247. }
  248. message PrepareRecoveryResponseProto {
  249. optional SegmentStateProto segmentState = 1;
  250. optional uint64 acceptedInEpoch = 2;
  251. required uint64 lastWriterEpoch = 3;
  252. // The highest committed txid that this logger has ever seen.
  253. // This may be higher than the data it actually has, in the case
  254. // that it was lagging before the old writer crashed.
  255. optional uint64 lastCommittedTxId = 4;
  256. }
  257. /**
  258. * acceptRecovery()
  259. */
  260. message AcceptRecoveryRequestProto {
  261. required RequestInfoProto reqInfo = 1;
  262. /** Details on the segment to recover */
  263. required SegmentStateProto stateToAccept = 2;
  264. /** The URL from which the log may be copied */
  265. required string fromURL = 3;
  266. }
  267. message AcceptRecoveryResponseProto {
  268. }
  269. /**
  270. * Protocol used to journal edits to a JournalNode.
  271. * See the request and response for details of rpc call.
  272. */
  273. service QJournalProtocolService {
  274. rpc isFormatted(IsFormattedRequestProto) returns (IsFormattedResponseProto);
  275. rpc getJournalCTime(GetJournalCTimeRequestProto) returns (GetJournalCTimeResponseProto);
  276. rpc doPreUpgrade(DoPreUpgradeRequestProto) returns (DoPreUpgradeResponseProto);
  277. rpc doUpgrade(DoUpgradeRequestProto) returns (DoUpgradeResponseProto);
  278. rpc doFinalize(DoFinalizeRequestProto) returns (DoFinalizeResponseProto);
  279. rpc canRollBack(CanRollBackRequestProto) returns (CanRollBackResponseProto);
  280. rpc doRollback(DoRollbackRequestProto) returns (DoRollbackResponseProto);
  281. rpc discardSegments(DiscardSegmentsRequestProto) returns (DiscardSegmentsResponseProto);
  282. rpc getJournalState(GetJournalStateRequestProto) returns (GetJournalStateResponseProto);
  283. rpc newEpoch(NewEpochRequestProto) returns (NewEpochResponseProto);
  284. rpc format(FormatRequestProto) returns (FormatResponseProto);
  285. rpc journal(JournalRequestProto) returns (JournalResponseProto);
  286. rpc heartbeat(HeartbeatRequestProto) returns (HeartbeatResponseProto);
  287. rpc startLogSegment(StartLogSegmentRequestProto)
  288. returns (StartLogSegmentResponseProto);
  289. rpc finalizeLogSegment(FinalizeLogSegmentRequestProto)
  290. returns (FinalizeLogSegmentResponseProto);
  291. rpc purgeLogs(PurgeLogsRequestProto)
  292. returns (PurgeLogsResponseProto);
  293. rpc getEditLogManifest(GetEditLogManifestRequestProto)
  294. returns (GetEditLogManifestResponseProto);
  295. rpc prepareRecovery(PrepareRecoveryRequestProto)
  296. returns (PrepareRecoveryResponseProto);
  297. rpc acceptRecovery(AcceptRecoveryRequestProto)
  298. returns (AcceptRecoveryResponseProto);
  299. }