secfree created HADOOP-18059:
--------------------------------

             Summary: CachedDNSToSwitchMapping#reloadCachedMappings is not 
consistent with CachedDNSToSwitchMapping#resolve
                 Key: HADOOP-18059
                 URL: https://issues.apache.org/jira/browse/HADOOP-18059
             Project: Hadoop Common
          Issue Type: Bug
            Reporter: secfree


The follow test case failed.

{code}
public class TestCachedDNSToSwitchMapping {

  @Test
  public void testReloadCachedMappings() {
    StaticMapping.resetMap();
    StaticMapping.addNodeToRack("127.0.0.1", "/rack0");
    StaticMapping.addNodeToRack("notexisit.host.com", "/rack1");
    CachedDNSToSwitchMapping cacheMapping =
        new CachedDNSToSwitchMapping(new StaticMapping());
    List<String> names = new ArrayList<>();
    names.add("localhost");
    names.add("notexisit.host.com");
    cacheMapping.resolve(names);
    Assert.assertTrue(cacheMapping.getSwitchMap().containsKey("127.0.0.1"));
    
Assert.assertTrue(cacheMapping.getSwitchMap().containsKey("notexisit.host.com"));
    cacheMapping.reloadCachedMappings(names);
    // failed here
    Assert.assertEquals(0, cacheMapping.getSwitchMap().keySet().size());
  }
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to