HDFS-49. MiniDFSCluster.stopDataNode will always shut down a node in the cluster if a matching name is not found. (stevel)
This commit is contained in:
parent
61b4116b4b
commit
aa16173a0d
|
@ -505,6 +505,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
|
|
||||||
HDFS-7676. Fix TestFileTruncate to avoid bug of HDFS-7611. (shv)
|
HDFS-7676. Fix TestFileTruncate to avoid bug of HDFS-7611. (shv)
|
||||||
|
|
||||||
|
HDFS-49. MiniDFSCluster.stopDataNode will always shut down a node in
|
||||||
|
the cluster if a matching name is not found. (stevel)
|
||||||
|
|
||||||
Release 2.6.1 - UNRELEASED
|
Release 2.6.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -1926,6 +1926,9 @@ public class MiniDFSCluster {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shutdown a particular datanode
|
* Shutdown a particular datanode
|
||||||
|
* @param i node index
|
||||||
|
* @return null if the node index is out of range, else the properties of the
|
||||||
|
* removed node
|
||||||
*/
|
*/
|
||||||
public synchronized DataNodeProperties stopDataNode(int i) {
|
public synchronized DataNodeProperties stopDataNode(int i) {
|
||||||
if (i < 0 || i >= dataNodes.size()) {
|
if (i < 0 || i >= dataNodes.size()) {
|
||||||
|
@ -1944,18 +1947,20 @@ public class MiniDFSCluster {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shutdown a datanode by name.
|
* Shutdown a datanode by name.
|
||||||
|
* @return the removed datanode or null if there was no match
|
||||||
*/
|
*/
|
||||||
public synchronized DataNodeProperties stopDataNode(String dnName) {
|
public synchronized DataNodeProperties stopDataNode(String dnName) {
|
||||||
int i;
|
int node = -1;
|
||||||
for (i = 0; i < dataNodes.size(); i++) {
|
for (int i = 0; i < dataNodes.size(); i++) {
|
||||||
DataNode dn = dataNodes.get(i).datanode;
|
DataNode dn = dataNodes.get(i).datanode;
|
||||||
LOG.info("DN name=" + dnName + " found DN=" + dn +
|
LOG.info("DN name=" + dnName + " found DN=" + dn +
|
||||||
" with name=" + dn.getDisplayName());
|
" with name=" + dn.getDisplayName());
|
||||||
if (dnName.equals(dn.getDatanodeId().getXferAddr())) {
|
if (dnName.equals(dn.getDatanodeId().getXferAddr())) {
|
||||||
|
node = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stopDataNode(i);
|
return stopDataNode(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue