123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- // This file contains protocol buffers that are used throughout HDFS -- i.e.
- // by the client, server, and data transfer protocols.
- option java_package = "org.apache.hadoop.hdfs.protocol.proto";
- option java_outer_classname = "DatanodeProtocolProtos";
- option java_generic_services = true;
- option java_generate_equals_and_hash = true;
- import "hdfs.proto";
- /**
- * Information to identify a datanode to a namenode
- */
- message DatanodeRegistrationProto {
- required DatanodeIDProto datanodeID = 1; // Datanode information
- required StorageInfoProto storageInfo = 2; // Node information
- required ExportedBlockKeysProto keys = 3; // Block keys
- }
- /**
- * Commands sent from namenode to the datanodes
- */
- message DatanodeCommandProto {
- enum Type {
- BalancerBandwidthCommand = 0;
- BlockCommand = 1;
- BlockRecoveryCommand = 2;
- FinalizeCommand = 3;
- KeyUpdateCommand = 4;
- RegisterCommand = 5;
- UpgradeCommand = 6;
- }
- required Type cmdType = 1; // Type of the command
- // One of the following command is available when the corresponding
- // cmdType is set
- optional BalancerBandwidthCommandProto balancerCmd = 2;
- optional BlockCommandProto blkCmd = 3;
- optional BlockRecoveryCommandProto recoveryCmd = 4;
- optional FinalizeCommandProto finalizeCmd = 5;
- optional KeyUpdateCommandProto keyUpdateCmd = 6;
- optional RegisterCommandProto registerCmd = 7;
- optional UpgradeCommandProto upgradeCmd = 8;
- }
- /**
- * Command sent from namenode to datanode to set the
- * maximum bandwidth to be used for balancing.
- */
- message BalancerBandwidthCommandProto {
- // Maximum bandwidth to be used by datanode for balancing
- required uint64 bandwidth = 1;
- }
- /**
- * Command to instruct datanodes to perform certain action
- * on the given set of blocks.
- */
- message BlockCommandProto {
- enum Action {
- TRANSFER = 1; // Transfer blocks to another datanode
- INVALIDATE = 2; // Invalidate blocks
- }
- required Action action = 1;
- required string blockPoolId = 2;
- repeated BlockProto blocks = 3;
- repeated DatanodeInfosProto targets = 4;
- }
- /**
- * List of blocks to be recovered by the datanode
- */
- message BlockRecoveryCommandProto {
- repeated RecoveringBlockProto blocks = 1;
- }
- /**
- * Finalize the upgrade at the datanode
- */
- message FinalizeCommandProto {
- required string blockPoolId = 1; // Block pool to be finalized
- }
- /**
- * Update the block keys at the datanode
- */
- message KeyUpdateCommandProto {
- required ExportedBlockKeysProto keys = 1;
- }
- /**
- * Instruct datanode to register with the namenode
- */
- message RegisterCommandProto {
- // void
- }
- /**
- * Generic distributed upgrade Command
- */
- message UpgradeCommandProto {
- enum Action {
- UNKNOWN = 0; // Unknown action
- REPORT_STATUS = 100; // Report upgrade status
- START_UPGRADE = 101; // Start upgrade
- }
- required Action action = 1; // Upgrade action
- required uint32 version = 2; // Version of the upgrade
- required uint32 upgradeStatus = 3; // % completed in range 0 & 100
- }
- /**
- * registration - Information of the datanode registering with the namenode
- */
- message RegisterDatanodeRequestProto {
- required DatanodeRegistrationProto registration = 1; // Datanode info
- }
- /**
- * registration - Update registration of the datanode that successfully
- * registered. StorageInfo will be updated to include new
- * storage ID if the datanode did not have one in the request.
- */
- message RegisterDatanodeResponseProto {
- required DatanodeRegistrationProto registration = 1; // Datanode info
- }
- /**
- * registration - datanode registration information
- * capacity - total storage capacity available at the datanode
- * dfsUsed - storage used by HDFS
- * remaining - remaining storage available for HDFS
- * blockPoolUsed - storage used by the block pool
- * xmitsInProgress - number of transfers from this datanode to others
- * xceiverCount - number of active transceiver threads
- * failedVolumes - number of failed volumes
- */
- message HeartbeatRequestProto {
- required DatanodeRegistrationProto registration = 1; // Datanode info
- required uint64 capacity = 2;
- required uint64 dfsUsed = 3;
- required uint64 remaining = 4;
- required uint64 blockPoolUsed = 5;
- required uint32 xmitsInProgress = 6;
- required uint32 xceiverCount = 7;
- required uint32 failedVolumes = 8;
- }
- /**
- * cmds - Commands from namenode to datanode.
- */
- message HeartbeatResponseProto {
- repeated DatanodeCommandProto cmds = 1; // Returned commands can be null
- }
- /**
- * registration - datanode registration information
- * blockPoolID - block pool ID of the reported blocks
- * blocks - each block is represented as two longs in the array.
- * first long represents block ID
- * second long represents length
- */
- message BlockReportRequestProto {
- required DatanodeRegistrationProto registration = 1;
- required string blockPoolId = 2;
- repeated uint64 blocks = 3 [packed=true];
- }
- /**
- * cmd - Command from namenode to the datanode
- */
- message BlockReportResponseProto {
- required DatanodeCommandProto cmd = 1;
- }
- /**
- * Data structure to send received or deleted block information
- * from datanode to namenode.
- *
- * deleteHint set to "-" indicates block deletion.
- * other deleteHint indicates block addition.
- */
- message ReceivedDeletedBlockInfoProto {
- required BlockProto block = 1;
- optional string deleteHint = 2;
- }
- /**
- * registration - datanode registration information
- * blockPoolID - block pool ID of the reported blocks
- * blocks - Received/deleted block list
- */
- message BlockReceivedAndDeletedRequestProto {
- required DatanodeRegistrationProto registration = 1;
- required string blockPoolId = 2;
- repeated ReceivedDeletedBlockInfoProto blocks = 3;
- }
- /**
- * void response
- */
- message BlockReceivedAndDeletedResponseProto {
- }
- /**
- * registartion - Datanode reporting the error
- * errorCode - error code indicating the error
- * msg - Free text description of the error
- */
- message ErrorReportRequestProto {
- enum ErrorCode {
- NOTIFY = 0; // Error report to be logged at the namenode
- DISK_ERROR = 1; // DN has disk errors but still has valid volumes
- INVALID_BLOCK = 2; // Command from namenode has invalid block ID
- FATAL_DISK_ERROR = 3; // No valid volumes left on datanode
- }
- required DatanodeRegistrationProto registartion = 1; // Registartion info
- required uint32 errorCode = 2; // Error code
- required string msg = 3; // Error message
- }
- /**
- * void response
- */
- message ErrorReportResponseProto {
- }
- /**
- * cmd - Upgrade command sent from datanode to namenode
- */
- message ProcessUpgradeRequestProto {
- optional UpgradeCommandProto cmd = 1;
- }
- /**
- * cmd - Upgrade command sent from namenode to datanode
- */
- message ProcessUpgradeResponseProto {
- optional UpgradeCommandProto cmd = 1;
- }
- /**
- * blocks - list of blocks that are reported as corrupt
- */
- message ReportBadBlocksRequestProto {
- repeated LocatedBlockProto blocks = 1;
- }
- /**
- * void response
- */
- message ReportBadBlocksResponseProto {
- }
- /**
- * Commit block synchronization request during lease recovery
- */
- message CommitBlockSynchronizationRequestProto {
- required ExtendedBlockProto block = 1;
- required uint64 newGenStamp = 2;
- required uint64 newLength = 3;
- required bool closeFile = 4;
- required bool deleteBlock = 5;
- repeated DatanodeIDProto newTaragets = 6;
- }
- /**
- * void response
- */
- message CommitBlockSynchronizationResponseProto {
- }
- /**
- * Protocol used from datanode to the namenode
- * See the request and response for details of rpc call.
- */
- service DatanodeProtocolService {
- /**
- * Register a datanode at a namenode
- */
- rpc registerDatanode(RegisterDatanodeRequestProto)
- returns(RegisterDatanodeResponseProto);
- /**
- * Send heartbeat from datanode to namenode
- */
- rpc sendHeartbeat(HeartbeatRequestProto) returns(HeartbeatResponseProto);
- /**
- * Report blocks at a given datanode to the namenode
- */
- rpc blockReport(BlockReportRequestProto) returns(BlockReportResponseProto);
- /**
- * Report from datanode about recently received or deleted block
- */
- rpc blockReceivedAndDeleted(BlockReceivedAndDeletedRequestProto)
- returns(BlockReceivedAndDeletedResponseProto);
- /**
- * Report from a datanode of an error to the active namenode.
- * Used for debugging.
- */
- rpc errorReport(ErrorReportRequestProto) returns(ErrorReportResponseProto);
-
- /**
- * Request the version
- */
- rpc versionRequest(VersionRequestProto) returns(VersionResponseProto);
- /**
- * Generic way to send commands from datanode to namenode during
- * distributed upgrade process.
- */
- rpc processUpgrade(ProcessUpgradeRequestProto) returns(ProcessUpgradeResponseProto);
- /**
- * Report corrupt blocks at the specified location
- */
- rpc reportBadBlocks(ReportBadBlocksRequestProto) returns(ReportBadBlocksResponseProto);
- /**
- * Commit block synchronization during lease recovery.
- */
- rpc commitBlockSynchronization(CommitBlockSynchronizationRequestProto)
- returns(CommitBlockSynchronizationResponseProto);
- }
|