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:
parent
3128c78636
commit
0f70398292
@ -197,6 +197,9 @@ Release 0.23.1 - Unreleased
|
|||||||
|
|
||||||
HADOOP-7898. Fix javadoc warnings in AuthenticationToken.java. (suresh)
|
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
|
Release 0.23.0 - 2011-11-01
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -38,9 +38,11 @@
|
|||||||
public class StaticMapping extends AbstractDNSToSwitchMapping {
|
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>.
|
* 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.
|
* <b>Important: </b>spaces not trimmed and are considered significant.
|
||||||
*/
|
*/
|
||||||
public static final String KEY_HADOOP_CONFIGURED_NODE_MAPPING =
|
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
|
* Declare that this mapping is always multi-switch
|
||||||
* @return the current switching status
|
* @return false, always
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isSingleSwitch() {
|
public boolean isSingleSwitch() {
|
||||||
synchronized (nameToRackMap) {
|
return false;
|
||||||
return nameToRackMap.isEmpty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the map and revert to being a single switch
|
* Clear the map
|
||||||
*/
|
*/
|
||||||
public static void resetMap() {
|
public static void resetMap() {
|
||||||
synchronized (nameToRackMap) {
|
synchronized (nameToRackMap) {
|
||||||
|
@ -44,7 +44,8 @@ private StaticMapping newInstance() {
|
|||||||
@Test
|
@Test
|
||||||
public void testStaticIsSingleSwitch() throws Throwable {
|
public void testStaticIsSingleSwitch() throws Throwable {
|
||||||
StaticMapping mapping = newInstance();
|
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();
|
StaticMapping staticMapping = newInstance();
|
||||||
CachedDNSToSwitchMapping mapping =
|
CachedDNSToSwitchMapping mapping =
|
||||||
new CachedDNSToSwitchMapping(staticMapping);
|
new CachedDNSToSwitchMapping(staticMapping);
|
||||||
assertTrue("Expected single switch", mapping.isSingleSwitch());
|
|
||||||
StaticMapping.addNodeToRack("n1", "r1");
|
StaticMapping.addNodeToRack("n1", "r1");
|
||||||
assertFalse("Expected to be multi switch",
|
assertFalse("Expected multi switch", mapping.isSingleSwitch());
|
||||||
mapping.isSingleSwitch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -96,8 +95,9 @@ public void testReadNodesFromConfig() throws Throwable {
|
|||||||
public void testNullConfiguration() throws Throwable {
|
public void testNullConfiguration() throws Throwable {
|
||||||
StaticMapping mapping = newInstance();
|
StaticMapping mapping = newInstance();
|
||||||
mapping.setConf(null);
|
mapping.setConf(null);
|
||||||
assertTrue("Null maps is not single switch", mapping.isSingleSwitch());
|
assertFalse("Null maps are expected to be multi switch",
|
||||||
assertTrue("Expected to be single switch",
|
mapping.isSingleSwitch());
|
||||||
|
assertFalse("Expected to be multi switch",
|
||||||
AbstractDNSToSwitchMapping.isMappingSingleSwitch(mapping));
|
AbstractDNSToSwitchMapping.isMappingSingleSwitch(mapping));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user