Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class DatanodeDetails extends NodeImpl implements
private String certSerialId;
private String version;
private long setupTime;
private String revision;
private String buildDate;

/**
* Constructs DatanodeDetails instance. DatanodeDetails.Builder is used
Expand All @@ -63,11 +65,13 @@ public class DatanodeDetails extends NodeImpl implements
* @param certSerialId serial id from SCM issued certificate.
* @param version DataNode's version
* @param setupTime the setup time of DataNode
* @param revision DataNodes's revision
* @param buildDate DataNodes's build timestamp
*/
@SuppressWarnings("parameternumber")
private DatanodeDetails(UUID uuid, String ipAddress, String hostName,
String networkLocation, List<Port> ports, String certSerialId,
String version, long setupTime) {
String version, long setupTime, String revision, String buildDate) {
super(hostName, networkLocation, NetConstants.NODE_COST_DEFAULT);
this.uuid = uuid;
this.ipAddress = ipAddress;
Expand All @@ -76,6 +80,8 @@ private DatanodeDetails(UUID uuid, String ipAddress, String hostName,
this.certSerialId = certSerialId;
this.version = version;
this.setupTime = setupTime;
this.revision = revision;
this.buildDate = buildDate;
}

public DatanodeDetails(DatanodeDetails datanodeDetails) {
Expand All @@ -89,6 +95,8 @@ public DatanodeDetails(DatanodeDetails datanodeDetails) {
this.setParent(datanodeDetails.getParent());
this.version = datanodeDetails.version;
this.setupTime = datanodeDetails.setupTime;
this.revision = datanodeDetails.revision;
this.buildDate = datanodeDetails.buildDate;
}

/**
Expand Down Expand Up @@ -223,6 +231,12 @@ public static DatanodeDetails getFromProtoBuf(
if (datanodeDetailsProto.hasSetupTime()) {
builder.setSetupTime(datanodeDetailsProto.getSetupTime());
}
if (datanodeDetailsProto.hasRevision()) {
builder.setRevision(datanodeDetailsProto.getRevision());
}
if (datanodeDetailsProto.hasBuildDate()) {
builder.setBuildDate(datanodeDetailsProto.getBuildDate());
}
return builder.build();
}

Expand Down Expand Up @@ -271,6 +285,13 @@ public HddsProtos.DatanodeDetailsProto getProtoBufMessage() {

builder.setSetupTime(getSetupTime());

if (!Strings.isNullOrEmpty(getRevision())) {
builder.setRevision(getRevision());
}
if (!Strings.isNullOrEmpty(getBuildDate())) {
builder.setBuildDate(getBuildDate());
}

return builder.build();
}

Expand Down Expand Up @@ -325,6 +346,8 @@ public static final class Builder {
private String certSerialId;
private String version;
private long setupTime;
private String revision;
private String buildDate;

/**
* Default private constructor. To create Builder instance use
Expand Down Expand Up @@ -425,6 +448,30 @@ public Builder setVersion(String ver) {
return this;
}

/**
* Sets the DataNode revision.
*
* @param rev the revision of DataNode.
*
* @return DatanodeDetails.Builder
*/
public Builder setRevision(String rev) {
this.revision = rev;
return this;
}

/**
* Sets the DataNode build date.
*
* @param date the build date of DataNode.
*
* @return DatanodeDetails.Builder
*/
public Builder setBuildDate(String date) {
this.buildDate = date;
return this;
}

/**
* Sets the DataNode setup time.
*
Expand All @@ -448,7 +495,8 @@ public DatanodeDetails build() {
networkLocation = NetConstants.DEFAULT_RACK;
}
DatanodeDetails dn = new DatanodeDetails(id, ipAddress, hostName,
networkLocation, ports, certSerialId, version, setupTime);
networkLocation, ports, certSerialId,
version, setupTime, revision, buildDate);
if (networkName != null) {
dn.setNetworkName(networkName);
}
Expand Down Expand Up @@ -590,4 +638,40 @@ public long getSetupTime() {
public void setSetupTime(long setupTime) {
this.setupTime = setupTime;
}

/**
* Returns the DataNode revision.
*
* @return DataNode revision
*/
public String getRevision() {
return revision;
}

/**
* Set DataNode revision.
*
* @param rev DataNode revision
*/
public void setRevision(String rev) {
this.revision = rev;
}

/**
* Returns the DataNode build date.
*
* @return DataNode build date
*/
public String getBuildDate() {
return buildDate;
}

/**
* Set DataNode build date.
*
* @param date DataNode build date
*/
public void setBuildDate(String date) {
this.buildDate = date;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ public void start() {
datanodeDetails.setVersion(
HddsVersionInfo.HDDS_VERSION_INFO.getVersion());
datanodeDetails.setSetupTime(Time.now());
datanodeDetails.setRevision(
HddsVersionInfo.HDDS_VERSION_INFO.getRevision());
datanodeDetails.setBuildDate(HddsVersionInfo.HDDS_VERSION_INFO.getDate());
TracingUtil.initTracing(
"HddsDatanodeService." + datanodeDetails.getUuidString()
.substring(0, 8), conf);
Expand Down
2 changes: 2 additions & 0 deletions hadoop-hdds/interface-client/src/main/proto/hdds.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ message DatanodeDetailsProto {
optional string networkLocation = 7; // Network topology location
optional string version = 8; // Datanode version
optional int64 setupTime = 9;
optional string revision = 10;
optional string buildDate = 11;
// TODO(runzhiwang): when uuid is gone, specify 1 as the index of uuid128 and mark as required
optional UUID uuid128 = 100; // UUID with 128 bits assigned to the Datanode.
}
Expand Down
12 changes: 11 additions & 1 deletion hadoop-hdds/interface-client/src/main/proto/proto.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,16 @@
"name": "setupTime",
"type": "int64"
},
{
"id": 10,
"name": "revision",
"type": "string"
},
{
"id": 11,
"name": "buildDate",
"type": "string"
},
{
"id": 100,
"name": "uuid128",
Expand Down Expand Up @@ -1935,4 +1945,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public Response getDatanodes() {
.withUUid(datanode.getUuidString())
.withVersion(datanode.getVersion())
.withSetupTime(datanode.getSetupTime())
.withRevision(datanode.getRevision())
.withBuildDate(datanode.getBuildDate())
.build());
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public final class DatanodeMetadata {
@XmlElement(name = "setupTime")
private long setupTime;

@XmlElement(name = "revision")
private String revision;

@XmlElement(name = "buildDate")
private String buildDate;

private DatanodeMetadata(Builder builder) {
this.hostname = builder.hostname;
this.uuid = builder.uuid;
Expand All @@ -72,6 +78,8 @@ private DatanodeMetadata(Builder builder) {
this.leaderCount = builder.leaderCount;
this.version = builder.version;
this.setupTime = builder.setupTime;
this.revision = builder.revision;
this.buildDate = builder.buildDate;
}

public String getHostname() {
Expand Down Expand Up @@ -114,6 +122,14 @@ public long getSetupTime() {
return setupTime;
}

public String getRevision() {
return revision;
}

public String getBuildDate() {
return buildDate;
}

/**
* Returns new builder class that builds a DatanodeMetadata.
*
Expand All @@ -138,6 +154,8 @@ public static final class Builder {
private int leaderCount;
private String version;
private long setupTime;
private String revision;
private String buildDate;

public Builder() {
this.containers = 0;
Expand Down Expand Up @@ -195,6 +213,16 @@ public Builder withSetupTime(long setupTime) {
return this;
}

public Builder withRevision(String revision) {
this.revision = revision;
return this;
}

public Builder withBuildDate(String buildDate) {
this.buildDate = buildDate;
return this;
}

/**
* Constructs DatanodeMetadata.
*
Expand Down
Loading