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 @@ -195,15 +195,6 @@ public String getHostName() {
return hostName;
}

/**
* Returns the Hostname and IP of the datanode separated by a slash.
*
* Eg: datanode001.corp/192.168.0.123
*/
public String getHostNameAndIP() {
return getHostName() + "/" + getIpAddress();
}

/**
* Sets a DataNode Port.
*
Expand Down Expand Up @@ -503,6 +494,10 @@ public void setCurrentVersion(int currentVersion) {

@Override
public String toString() {
return uuidString + "(" + hostName + "/" + ipAddress + ")";
}

public String toDebugString() {
return uuid.toString() + "{" +
"ip: " +
ipAddress +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.stream.IntStream;

import static java.util.Collections.unmodifiableSortedMap;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toMap;

/**
Expand Down Expand Up @@ -91,14 +90,8 @@ public String toString() {
+ "containerID=" + containerID
+ ", replication=" + ecReplicationConfig.getReplication()
+ ", missingIndexes=" + Arrays.toString(missingContainerIndexes)
+ ", sources={" + toString(sourceNodeMap) + "}"
+ ", targets={" + toString(targetNodeMap) + "}}";
}

private String toString(SortedMap<Integer, DatanodeDetails> nodeMap) {
return nodeMap.entrySet().stream()
.map(e -> e.getKey() + ":" + e.getValue().getHostNameAndIP())
.collect(joining(","));
+ ", sources=" + sourceNodeMap
+ ", targets=" + targetNodeMap + "}";
}

public long getTerm() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,10 @@ public String toString() {
.append(": containerID: ").append(containerID)
.append(", replicationConfig: ").append(ecReplicationConfig)
.append(", sources: [").append(getSources().stream()
.map(a -> a.dnDetails.getHostNameAndIP()
.map(a -> a.dnDetails
+ " replicaIndex: " + a.getReplicaIndex())
.collect(Collectors.joining(", "))).append("]")
.append(", targets: [").append(getTargetDatanodes().stream()
.map(DatanodeDetails::getHostNameAndIP)
.collect(Collectors.joining(", "))).append("]")
.append(", targets: ").append(getTargetDatanodes())
.append(", missingIndexes: ").append(
Arrays.toString(missingContainerIndexes));
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ public String toString() {
sb.append(getType());
sb.append(": containerId: ").append(getContainerID());
sb.append(", replicaIndex: ").append(getReplicaIndex());
sb.append(", sourceNodes: [");
sb.append(sourceDatanodes.stream()
.map(DatanodeDetails::getHostNameAndIP)
.collect(Collectors.joining(", "))).append("]");
sb.append(", sourceNodes: ").append(sourceDatanodes);
return sb.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -394,16 +394,16 @@ public RegisteredCommand register(
addEntryToDnsToUuidMap(dnsName, datanodeDetails.getUuidString());
// Updating Node Report, as registration is successful
processNodeReport(datanodeDetails, nodeReport);
LOG.info("Registered Data node : {}", datanodeDetails);
LOG.info("Registered Data node : {}", datanodeDetails.toDebugString());
scmNodeEventPublisher.fireEvent(SCMEvents.NEW_NODE, datanodeDetails);
} catch (NodeAlreadyExistsException e) {
if (LOG.isTraceEnabled()) {
LOG.trace("Datanode is already registered. Datanode: {}",
datanodeDetails.toString());
datanodeDetails);
}
} catch (NodeNotFoundException e) {
LOG.error("Cannot find datanode {} from nodeStateManager",
datanodeDetails.toString());
datanodeDetails);
}
} else {
// Update datanode if it is registered but the ip or hostname changes
Expand Down Expand Up @@ -543,9 +543,11 @@ protected void updateDatanodeOpState(DatanodeDetails reportedDn)
if (opStateDiffers(reportedDn, scmStatus)) {
if (scmContext.isLeader()) {
LOG.info("Scheduling a command to update the operationalState " +
"persisted on {} as the reported value does not " +
"persisted on {} as the reported value ({}, {}) does not " +
"match the value stored in SCM ({}, {})",
reportedDn,
reportedDn.getPersistedOpState(),
reportedDn.getPersistedOpStateExpiryEpochSec(),
scmStatus.getOperationalState(),
scmStatus.getOpStateExpiryEpochSeconds());

Expand All @@ -563,9 +565,11 @@ protected void updateDatanodeOpState(DatanodeDetails reportedDn)
}
} else {
LOG.info("Update the operationalState saved in follower SCM " +
"for {} as the reported value does not " +
"for {} as the reported value ({}, {}) does not " +
"match the value stored in SCM ({}, {})",
reportedDn,
reportedDn.getPersistedOpState(),
reportedDn.getPersistedOpStateExpiryEpochSec(),
scmStatus.getOperationalState(),
scmStatus.getOpStateExpiryEpochSeconds());

Expand Down