2016-10-21 16:42:54 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* These .proto interfaces are private and unstable.
|
|
|
|
* Please see http://wiki.apache.org/hadoop/Compatibility
|
|
|
|
* for what changes are allowed for a *unstable* .proto interface.
|
|
|
|
*/
|
|
|
|
|
|
|
|
option java_package = "org.apache.hadoop.ozone.protocol.proto";
|
|
|
|
|
|
|
|
option java_outer_classname = "StorageContainerDatanodeProtocolProtos";
|
|
|
|
|
|
|
|
option java_generic_services = true;
|
|
|
|
|
|
|
|
option java_generate_equals_and_hash = true;
|
|
|
|
|
|
|
|
package hadoop.hdfs;
|
2016-11-16 21:44:24 +00:00
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
import "hdfs.proto";
|
2016-11-16 21:44:24 +00:00
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
import "HdfsServer.proto";
|
2016-11-16 21:44:24 +00:00
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
import "DatanodeProtocol.proto";
|
2016-11-16 21:44:24 +00:00
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
import "DatanodeContainerProtocol.proto";
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This message is send by data node to indicate that it is alive or it is
|
|
|
|
* registering with the node manager.
|
|
|
|
*/
|
|
|
|
message SCMHeartbeatRequestProto {
|
|
|
|
required DatanodeIDProto datanodeID = 1;
|
2017-03-07 18:28:21 +00:00
|
|
|
optional SCMNodeReport nodeReport = 2;
|
|
|
|
optional ReportState containerReportState = 3;
|
2017-03-01 19:47:22 +00:00
|
|
|
}
|
|
|
|
|
2017-03-07 18:28:21 +00:00
|
|
|
enum ContainerState {
|
|
|
|
closed = 0;
|
|
|
|
open = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
NodeState contains messages from datanode to SCM saying that it has
|
|
|
|
some information that SCM might be interested in.*/
|
|
|
|
message ReportState {
|
|
|
|
enum states {
|
|
|
|
noContainerReports = 0;
|
|
|
|
completeContinerReport = 1;
|
|
|
|
deltaContainerReport = 2;
|
|
|
|
}
|
|
|
|
required states state = 1;
|
|
|
|
required int64 count = 2 [default = 0];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
This message is used to persist the information about a container in the
|
|
|
|
SCM database, This information allows SCM to startup faster and avoid having
|
|
|
|
all container info in memory all the time.
|
|
|
|
*/
|
|
|
|
message ContainerPersistanceProto {
|
|
|
|
required ContainerState state = 1;
|
|
|
|
required hadoop.hdfs.ozone.Pipeline pipeline = 2;
|
|
|
|
required ContainerInfo info = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
This message is used to do a quick look up of which containers are effected
|
|
|
|
if a node goes down
|
|
|
|
*/
|
|
|
|
message NodeContianerMapping {
|
|
|
|
repeated string contianerName = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
A container report contains the following information.
|
|
|
|
*/
|
|
|
|
message ContainerInfo {
|
|
|
|
required string containerName = 1;
|
2017-03-21 17:43:27 +00:00
|
|
|
required string finalhash = 2;
|
2017-03-07 18:28:21 +00:00
|
|
|
optional int64 size = 3;
|
|
|
|
optional int64 keycount = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
A set of container reports, max count is generally set to
|
|
|
|
8192 since that keeps the size of the reports under 1 MB.
|
|
|
|
*/
|
2017-03-21 17:43:27 +00:00
|
|
|
message ContainerReportsProto {
|
2017-03-07 18:28:21 +00:00
|
|
|
enum reportType {
|
|
|
|
fullReport = 0;
|
|
|
|
deltaReport = 1;
|
|
|
|
}
|
|
|
|
repeated ContainerInfo reports = 1;
|
|
|
|
required reportType type = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-03-01 19:47:22 +00:00
|
|
|
/**
|
|
|
|
* This message is send along with the heart beat to report datanode
|
|
|
|
* storage utilization by SCM.
|
|
|
|
*/
|
|
|
|
message SCMNodeReport {
|
2017-03-07 18:28:21 +00:00
|
|
|
repeated SCMStorageReport storageReport = 1;
|
2017-03-01 19:47:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message SCMStorageReport {
|
|
|
|
required string storageUuid = 1;
|
|
|
|
optional uint64 capacity = 2 [default = 0];
|
|
|
|
optional uint64 scmUsed = 3 [default = 0];
|
|
|
|
optional uint64 remaining = 4 [default = 0];
|
|
|
|
optional StorageTypeProto storageType = 5 [default = DISK];
|
2016-10-21 16:42:54 +00:00
|
|
|
}
|
|
|
|
|
2016-11-16 21:44:24 +00:00
|
|
|
message SCMRegisterRequestProto {
|
|
|
|
required DatanodeIDProto datanodeID = 1;
|
|
|
|
optional SCMNodeAddressList addressList = 2;
|
|
|
|
}
|
2016-10-21 16:42:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Request for version info of the software stack on the server.
|
|
|
|
*/
|
|
|
|
message SCMVersionRequestProto {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic response that is send to a version request. This allows keys to be
|
|
|
|
* added on the fly and protocol to remain stable.
|
|
|
|
*/
|
|
|
|
message SCMVersionResponseProto {
|
|
|
|
required uint32 softwareVersion = 1;
|
2016-11-16 21:44:24 +00:00
|
|
|
repeated hadoop.hdfs.ozone.KeyValue keys = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message SCMNodeAddressList {
|
|
|
|
repeated string addressList = 1;
|
2016-10-21 16:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Datanode ID returned by the SCM. This is similar to name node
|
|
|
|
* registeration of a datanode.
|
|
|
|
*/
|
2016-11-16 21:44:24 +00:00
|
|
|
message SCMRegisteredCmdResponseProto {
|
2016-10-27 00:33:37 +00:00
|
|
|
enum ErrorCode {
|
|
|
|
success = 1;
|
2016-11-16 21:44:24 +00:00
|
|
|
errorNodeNotPermitted = 2;
|
2016-10-27 00:33:37 +00:00
|
|
|
}
|
2016-11-16 21:44:24 +00:00
|
|
|
required ErrorCode errorCode = 2;
|
|
|
|
optional string datanodeUUID = 3;
|
|
|
|
optional string clusterID = 4;
|
|
|
|
optional SCMNodeAddressList addressList = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Container ID maintains the container's Identity along with cluster ID
|
|
|
|
* after the registration is done.
|
|
|
|
*/
|
|
|
|
message ContainerNodeIDProto {
|
|
|
|
required DatanodeIDProto datanodeID = 1;
|
|
|
|
optional string clusterID = 2;
|
2016-10-27 00:33:37 +00:00
|
|
|
}
|
|
|
|
|
2016-11-16 21:44:24 +00:00
|
|
|
|
2016-10-27 00:33:37 +00:00
|
|
|
/**
|
|
|
|
* Empty Command Response
|
|
|
|
*/
|
|
|
|
message NullCmdResponseProto {
|
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
}
|
|
|
|
|
2017-03-07 18:28:21 +00:00
|
|
|
/**
|
|
|
|
This command tells the data node to send in the container report when possible
|
|
|
|
*/
|
|
|
|
message SendContainerReportProto {
|
|
|
|
}
|
|
|
|
|
2016-11-16 21:44:24 +00:00
|
|
|
/**
|
|
|
|
Type of commands supported by SCM to datanode protocol.
|
|
|
|
*/
|
|
|
|
enum Type {
|
|
|
|
nullCmd = 1;
|
|
|
|
versionCommand = 2;
|
|
|
|
registeredCommand = 3;
|
2017-03-07 18:28:21 +00:00
|
|
|
sendContainerReport = 4;
|
2016-11-16 21:44:24 +00:00
|
|
|
}
|
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
/*
|
|
|
|
* These are commands returned by SCM for to the datanode to execute.
|
|
|
|
*/
|
2016-11-16 21:44:24 +00:00
|
|
|
message SCMCommandResponseProto {
|
|
|
|
required Type cmdType = 2; // Type of the command
|
|
|
|
optional NullCmdResponseProto nullCommand = 3;
|
2017-03-07 18:28:21 +00:00
|
|
|
optional SCMRegisteredCmdResponseProto registeredProto = 4;
|
|
|
|
optional SCMVersionResponseProto versionProto = 5;
|
|
|
|
optional SendContainerReportProto sendReport = 6;
|
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-10-27 00:33:37 +00:00
|
|
|
/*
|
|
|
|
* A group of commands for the datanode to execute
|
|
|
|
*/
|
|
|
|
message SCMHeartbeatResponseProto {
|
|
|
|
repeated SCMCommandResponseProto commands = 1;
|
|
|
|
}
|
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Protocol used from a datanode to StorageContainerManager.
|
|
|
|
*
|
|
|
|
* Please see the request and response messages for details of the RPC calls.
|
|
|
|
*
|
|
|
|
* Here is a simple state diagram that shows how a datanode would boot up and
|
|
|
|
* communicate with SCM.
|
|
|
|
*
|
2017-03-07 18:28:21 +00:00
|
|
|
* -----------------------
|
2016-10-21 16:42:54 +00:00
|
|
|
* | Start |
|
2017-03-07 18:28:21 +00:00
|
|
|
* ---------- ------------
|
2016-10-21 16:42:54 +00:00
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* |
|
2017-03-07 18:28:21 +00:00
|
|
|
* ----------v-------------
|
|
|
|
* | Searching for SCM ------------
|
|
|
|
* ---------- ------------- |
|
2016-10-21 16:42:54 +00:00
|
|
|
* | |
|
|
|
|
* | |
|
2017-03-07 18:28:21 +00:00
|
|
|
* | ----------v-------------
|
2016-10-21 16:42:54 +00:00
|
|
|
* | | Register if needed |
|
2017-03-07 18:28:21 +00:00
|
|
|
* | ----------- ------------
|
2016-10-21 16:42:54 +00:00
|
|
|
* | |
|
|
|
|
* v |
|
2017-03-07 18:28:21 +00:00
|
|
|
* ----------- ---------------- |
|
|
|
|
* --------- Heartbeat state <--------
|
|
|
|
* | --------^-------------------
|
2016-10-21 16:42:54 +00:00
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* | |
|
|
|
|
* | |
|
2017-03-07 18:28:21 +00:00
|
|
|
* ------------------
|
2016-10-21 16:42:54 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Here is how this protocol is used by the datanode. When a datanode boots up
|
|
|
|
* it moves into a stated called SEARCHING_SCM. In this state datanode is
|
|
|
|
* trying to establish communication with the SCM. The address of the SCMs are
|
|
|
|
* retrieved from the configuration information.
|
|
|
|
*
|
|
|
|
* In the SEARCHING_SCM state, only rpc call made by datanode is a getVersion
|
|
|
|
* call to SCM. Once any of the SCMs reply, datanode checks if it has a local
|
|
|
|
* persisted datanode ID. If it has this means that this datanode is already
|
|
|
|
* registered with some SCM. If this file is not found, datanode assumes that
|
|
|
|
* it needs to do a registration.
|
|
|
|
*
|
2016-11-16 21:44:24 +00:00
|
|
|
* If registration is need datanode moves into REGISTER state. It will
|
|
|
|
* send a register call with datanodeID data structure and presist that info.
|
2016-10-21 16:42:54 +00:00
|
|
|
*
|
2016-11-16 21:44:24 +00:00
|
|
|
* The response to the command contains clusterID. This information is
|
|
|
|
* also persisted by the datanode and moves into heartbeat state.
|
2016-10-21 16:42:54 +00:00
|
|
|
*
|
|
|
|
* Once in the heartbeat state, datanode sends heartbeats and container reports
|
|
|
|
* to SCM and process commands issued by SCM until it is shutdown.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
service StorageContainerDatanodeProtocolService {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the version information from the SCM.
|
|
|
|
*/
|
2016-11-16 21:44:24 +00:00
|
|
|
rpc getVersion (SCMVersionRequestProto) returns (SCMVersionResponseProto);
|
2016-10-21 16:42:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers a data node with SCM.
|
|
|
|
*/
|
2016-11-16 21:44:24 +00:00
|
|
|
rpc register (SCMRegisterRequestProto) returns (SCMRegisteredCmdResponseProto);
|
2016-10-21 16:42:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send heartbeat from datanode to SCM. HB's under SCM looks more
|
|
|
|
* like life line protocol than HB's under HDFS. In other words, it is
|
|
|
|
* extremely light weight and contains no data payload.
|
|
|
|
*/
|
2016-10-27 00:33:37 +00:00
|
|
|
rpc sendHeartbeat (SCMHeartbeatRequestProto) returns (SCMHeartbeatResponseProto);
|
2017-03-21 17:43:27 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
send container reports sends the container report to SCM. This will
|
|
|
|
return a null command as response.
|
|
|
|
*/
|
|
|
|
rpc sendContainerReport(ContainerReportsProto) returns (SCMHeartbeatResponseProto);
|
|
|
|
|
2016-10-21 16:42:54 +00:00
|
|
|
}
|