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/trunk@1213263 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steve Loughran 2011-12-12 15:05:16 +00:00
parent 3128c78636
commit 0f70398292
3 changed files with 17 additions and 14 deletions

View File

@ -197,6 +197,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

View File

@ -38,9 +38,11 @@
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 List<String> resolve(List<String> names) {
}
/**
* 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) {

View File

@ -44,7 +44,8 @@ private StaticMapping newInstance() {
@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 void testCachingRelaysQueries() throws Throwable {
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 void testReadNodesFromConfig() throws Throwable {
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));
}
}