HADOOP-7878 Regression: HADOOP-7777 switch changes break HDFS tests when the isSingleSwitch() predicate is used
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1213264 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c0aeff42ac
commit
2c579d5570
|
@ -80,6 +80,9 @@ Release 0.23.1 - Unreleased
|
|||
|
||||
HADOOP-7898. Fix javadoc warnings in AuthenticationToken.java. (suresh)
|
||||
|
||||
HADOOP-7878 Regression: HADOOP-7777 switch changes break HDFS tests when the
|
||||
isSingleSwitch() predicate is used. (stevel)
|
||||
|
||||
Release 0.23.0 - 2011-11-01
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -38,9 +38,11 @@ import java.util.Map;
|
|||
public class StaticMapping extends AbstractDNSToSwitchMapping {
|
||||
|
||||
/**
|
||||
* key to define the node mapping as a comma-delimited list of host=rack
|
||||
* Key to define the node mapping as a comma-delimited list of host=rack
|
||||
* mappings, e.g. <code>host1=r1,host2=r1,host3=r2</code>.
|
||||
* </p>
|
||||
* <p/>
|
||||
* Value: {@value}
|
||||
* <p/>
|
||||
* <b>Important: </b>spaces not trimmed and are considered significant.
|
||||
*/
|
||||
public static final String KEY_HADOOP_CONFIGURED_NODE_MAPPING =
|
||||
|
@ -107,18 +109,16 @@ public class StaticMapping extends AbstractDNSToSwitchMapping {
|
|||
}
|
||||
|
||||
/**
|
||||
* This mapping is only single switch if the map is empty
|
||||
* @return the current switching status
|
||||
* Declare that this mapping is always multi-switch
|
||||
* @return false, always
|
||||
*/
|
||||
@Override
|
||||
public boolean isSingleSwitch() {
|
||||
synchronized (nameToRackMap) {
|
||||
return nameToRackMap.isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the map and revert to being a single switch
|
||||
* Clear the map
|
||||
*/
|
||||
public static void resetMap() {
|
||||
synchronized (nameToRackMap) {
|
||||
|
|
|
@ -44,7 +44,8 @@ public class TestStaticMapping extends Assert {
|
|||
@Test
|
||||
public void testStaticIsSingleSwitch() throws Throwable {
|
||||
StaticMapping mapping = newInstance();
|
||||
assertTrue("Empty maps are not single switch", mapping.isSingleSwitch());
|
||||
assertFalse("Empty maps should not be not single switch",
|
||||
mapping.isSingleSwitch());
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,10 +54,8 @@ public class TestStaticMapping extends Assert {
|
|||
StaticMapping staticMapping = newInstance();
|
||||
CachedDNSToSwitchMapping mapping =
|
||||
new CachedDNSToSwitchMapping(staticMapping);
|
||||
assertTrue("Expected single switch", mapping.isSingleSwitch());
|
||||
StaticMapping.addNodeToRack("n1", "r1");
|
||||
assertFalse("Expected to be multi switch",
|
||||
mapping.isSingleSwitch());
|
||||
assertFalse("Expected multi switch", mapping.isSingleSwitch());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -96,8 +95,9 @@ public class TestStaticMapping extends Assert {
|
|||
public void testNullConfiguration() throws Throwable {
|
||||
StaticMapping mapping = newInstance();
|
||||
mapping.setConf(null);
|
||||
assertTrue("Null maps is not single switch", mapping.isSingleSwitch());
|
||||
assertTrue("Expected to be single switch",
|
||||
assertFalse("Null maps are expected to be multi switch",
|
||||
mapping.isSingleSwitch());
|
||||
assertFalse("Expected to be multi switch",
|
||||
AbstractDNSToSwitchMapping.isMappingSingleSwitch(mapping));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue