QJournalProtocol.proto 9.3 KB

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