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/** 20 * These .proto interfaces are private and stable. 21 * Please see http://wiki.apache.org/hadoop/Compatibility 22 * for what changes are allowed for a *stable* .proto interface. 23 */ 24 25// This file contains protocol buffers that are used throughout HDFS -- i.e. 26// by the client, server, and data transfer protocols. 27 28option java_package = "org.apache.hadoop.hdfs.protocol.proto"; 29option java_outer_classname = "NamenodeProtocolProtos"; 30option java_generic_services = true; 31option java_generate_equals_and_hash = true; 32package hadoop.hdfs.namenode; 33 34import "hdfs.proto"; 35 36/** 37 * Get list of blocks for a given datanode with the total length 38 * of adding up to given size 39 * datanode - Datanode ID to get list of block from 40 * size - size to which the block lengths must add up to 41 */ 42message GetBlocksRequestProto { 43 required DatanodeIDProto datanode = 1; // Datanode ID 44 required uint64 size = 2; // Size in bytes 45} 46 47 48/** 49 * blocks - List of returned blocks 50 */ 51message GetBlocksResponseProto { 52 required BlocksWithLocationsProto blocks = 1; // List of blocks 53} 54 55/** 56 * void request 57 */ 58message GetBlockKeysRequestProto { 59} 60 61/** 62 * keys - Information about block keys at the active namenode 63 */ 64message GetBlockKeysResponseProto { 65 optional ExportedBlockKeysProto keys = 1; 66} 67 68/** 69 * void request 70 */ 71message GetTransactionIdRequestProto { 72} 73 74/** 75 * txId - Transaction ID of the most recently persisted edit log record 76 */ 77message GetTransactionIdResponseProto { 78 required uint64 txId = 1; // Transaction ID 79} 80 81/** 82 * void request 83 */ 84message RollEditLogRequestProto { 85} 86 87/** 88 * signature - A unique token to identify checkpoint transaction 89 */ 90message RollEditLogResponseProto { 91 required CheckpointSignatureProto signature = 1; 92} 93 94/** 95 * void request 96 */ 97message GetMostRecentCheckpointTxIdRequestProto { 98} 99 100message GetMostRecentCheckpointTxIdResponseProto{ 101 required uint64 txId = 1; 102} 103 104/** 105 * registration - Namenode reporting the error 106 * errorCode - error code indicating the error 107 * msg - Free text description of the error 108 */ 109message ErrorReportRequestProto { 110 required NamenodeRegistrationProto registration = 1; // Registration info 111 required uint32 errorCode = 2; // Error code 112 required string msg = 3; // Error message 113} 114 115/** 116 * void response 117 */ 118message ErrorReportResponseProto { 119} 120 121/** 122 * registration - Information of the namenode registering with primary namenode 123 */ 124message RegisterRequestProto { 125 required NamenodeRegistrationProto registration = 1; // Registration info 126} 127 128/** 129 * registration - Updated registration information of the newly registered 130 * datanode. 131 */ 132message RegisterResponseProto { 133 required NamenodeRegistrationProto registration = 1; // Registration info 134} 135 136/** 137 * Start checkpoint request 138 * registration - Namenode that is starting the checkpoint 139 */ 140message StartCheckpointRequestProto { 141 required NamenodeRegistrationProto registration = 1; // Registration info 142} 143 144/** 145 * command - Command returned by the active namenode to be 146 * be handled by the caller. 147 */ 148message StartCheckpointResponseProto { 149 required NamenodeCommandProto command = 1; 150} 151 152/** 153 * End or finalize the previously started checkpoint 154 * registration - Namenode that is ending the checkpoint 155 * signature - unique token to identify checkpoint transaction, 156 * that was received when checkpoint was started. 157 */ 158message EndCheckpointRequestProto { 159 required NamenodeRegistrationProto registration = 1; // Registration info 160 required CheckpointSignatureProto signature = 2; 161} 162 163/** 164 * void response 165 */ 166message EndCheckpointResponseProto { 167} 168 169/** 170 * sinceTxId - return the editlog information for transactions >= sinceTxId 171 */ 172message GetEditLogManifestRequestProto { 173 required uint64 sinceTxId = 1; // Transaction ID 174} 175 176/** 177 * manifest - Enumeration of editlogs from namenode for 178 * logs >= sinceTxId in the request 179 */ 180message GetEditLogManifestResponseProto { 181 required RemoteEditLogManifestProto manifest = 1; 182} 183 184/** 185 * void request 186 */ 187message IsUpgradeFinalizedRequestProto { 188} 189 190message IsUpgradeFinalizedResponseProto { 191 required bool isUpgradeFinalized = 1; 192} 193 194/** 195 * Protocol used by the sub-ordinate namenode to send requests 196 * the active/primary namenode. 197 * 198 * See the request and response for details of rpc call. 199 */ 200service NamenodeProtocolService { 201 /** 202 * Get list of blocks for a given datanode with length 203 * of blocks adding up to given size. 204 */ 205 rpc getBlocks(GetBlocksRequestProto) returns(GetBlocksResponseProto); 206 207 /** 208 * Get the current block keys 209 */ 210 rpc getBlockKeys(GetBlockKeysRequestProto) returns(GetBlockKeysResponseProto); 211 212 /** 213 * Get the transaction ID of the most recently persisted editlog record 214 */ 215 rpc getTransactionId(GetTransactionIdRequestProto) 216 returns(GetTransactionIdResponseProto); 217 218 /** 219 * Get the transaction ID of the most recently persisted editlog record 220 */ 221 rpc getMostRecentCheckpointTxId(GetMostRecentCheckpointTxIdRequestProto) 222 returns(GetMostRecentCheckpointTxIdResponseProto); 223 224 /** 225 * Close the current editlog and open a new one for checkpointing purposes 226 */ 227 rpc rollEditLog(RollEditLogRequestProto) returns(RollEditLogResponseProto); 228 229 /** 230 * Request info about the version running on this NameNode 231 */ 232 rpc versionRequest(VersionRequestProto) returns(VersionResponseProto); 233 234 /** 235 * Report from a sub-ordinate namenode of an error to the active namenode. 236 * Active namenode may decide to unregister the reporting namenode 237 * depending on the error. 238 */ 239 rpc errorReport(ErrorReportRequestProto) returns(ErrorReportResponseProto); 240 241 /** 242 * Request to register a sub-ordinate namenode 243 */ 244 rpc registerSubordinateNamenode(RegisterRequestProto) returns(RegisterResponseProto); 245 246 /** 247 * Request to start a checkpoint. 248 */ 249 rpc startCheckpoint(StartCheckpointRequestProto) 250 returns(StartCheckpointResponseProto); 251 252 /** 253 * End of finalize the previously started checkpoint 254 */ 255 rpc endCheckpoint(EndCheckpointRequestProto) 256 returns(EndCheckpointResponseProto); 257 258 /** 259 * Get editlog manifests from the active namenode for all the editlogs 260 */ 261 rpc getEditLogManifest(GetEditLogManifestRequestProto) 262 returns(GetEditLogManifestResponseProto); 263 264 /** 265 * Return whether the NameNode is in upgrade state (false) or not (true) 266 */ 267 rpc isUpgradeFinalized(IsUpgradeFinalizedRequestProto) 268 returns (IsUpgradeFinalizedResponseProto); 269} 270