HDFS-12605. [READ] TestNameNodeProvidedImplementation#testProvidedDatanodeFailures fails after rebase

This commit is contained in:
Virajith Jalaparti 2017-10-18 13:53:11 -07:00 committed by Chris Douglas
parent 17052c4aff
commit d6a9a89973
2 changed files with 15 additions and 3 deletions

View File

@ -489,6 +489,18 @@ void injectStorage(DatanodeStorageInfo s) {
synchronized (storageMap) { synchronized (storageMap) {
DatanodeStorageInfo storage = storageMap.get(s.getStorageID()); DatanodeStorageInfo storage = storageMap.get(s.getStorageID());
if (null == storage) { if (null == storage) {
LOG.info("Adding new storage ID {} for DN {}", s.getStorageID(),
getXferAddr());
DFSTopologyNodeImpl parent = null;
if (getParent() instanceof DFSTopologyNodeImpl) {
parent = (DFSTopologyNodeImpl) getParent();
}
StorageType type = s.getStorageType();
if (!hasStorageType(type) && parent != null) {
// we are about to add a type this node currently does not have,
// inform the parent that a new type is added to this datanode
parent.childAddStorage(getName(), type);
}
storageMap.put(s.getStorageID(), s); storageMap.put(s.getStorageID(), s);
} else { } else {
assert storage == s : "found " + storage + " expected " + s; assert storage == s : "found " + storage + " expected " + s;

View File

@ -481,13 +481,13 @@ public void testProvidedDatanodeFailures() throws Exception {
assertEquals(providedDatanode2.getDatanodeUuid(), assertEquals(providedDatanode2.getDatanodeUuid(),
dnInfos[0].getDatanodeUuid()); dnInfos[0].getDatanodeUuid());
//stop the 2nd provided datanode // stop the 2nd provided datanode
cluster.stopDataNode(1); MiniDFSCluster.DataNodeProperties providedDNProperties2 =
cluster.stopDataNode(0);
// make NameNode detect that datanode is down // make NameNode detect that datanode is down
BlockManagerTestUtil.noticeDeadDatanode( BlockManagerTestUtil.noticeDeadDatanode(
cluster.getNameNode(), cluster.getNameNode(),
providedDatanode2.getDatanodeId().getXferAddr()); providedDatanode2.getDatanodeId().getXferAddr());
getAndCheckBlockLocations(client, filename, 0); getAndCheckBlockLocations(client, filename, 0);
//restart the provided datanode //restart the provided datanode