HADOOP-9998. Provide methods to clear only part of the DNSToSwitchMapping. (Junping Du via Colin Patrick McCabe)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1526568 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e132b1a2b
commit
fa2a3c94f2
|
@ -49,6 +49,9 @@ Release 2.3.0 - UNRELEASED
|
|||
HADOOP-9915. o.a.h.fs.Stat support on Mac OS X (Binglin Chang via Colin
|
||||
Patrick McCabe)
|
||||
|
||||
HADOOP-9998. Provide methods to clear only part of the DNSToSwitchMapping.
|
||||
(Junping Du via Colin Patrick McCabe)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
HADOOP-9748. Reduce blocking on UGI.ensureInitialized (daryn)
|
||||
|
|
|
@ -154,4 +154,11 @@ public class CachedDNSToSwitchMapping extends AbstractDNSToSwitchMapping {
|
|||
public void reloadCachedMappings() {
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
for (String name : names) {
|
||||
cache.remove(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,4 +59,12 @@ public interface DNSToSwitchMapping {
|
|||
* will get a chance to see the new data.
|
||||
*/
|
||||
public void reloadCachedMappings();
|
||||
|
||||
/**
|
||||
* Reload cached mappings on specific nodes.
|
||||
*
|
||||
* If there is a cache on these nodes, this method will clear it, so that
|
||||
* future accesses will see updated data.
|
||||
*/
|
||||
public void reloadCachedMappings(List<String> names);
|
||||
}
|
||||
|
|
|
@ -269,5 +269,11 @@ public final class ScriptBasedMapping extends CachedDNSToSwitchMapping {
|
|||
// Nothing to do here, since RawScriptBasedMapping has no cache, and
|
||||
// does not inherit from CachedDNSToSwitchMapping
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
// Nothing to do here, since RawScriptBasedMapping has no cache, and
|
||||
// does not inherit from CachedDNSToSwitchMapping
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,5 +162,12 @@ public class TableMapping extends CachedDNSToSwitchMapping {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
// TableMapping has to reload all mappings at once, so no chance to
|
||||
// reload mappings on specific nodes
|
||||
reloadCachedMappings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,4 +152,10 @@ public class StaticMapping extends AbstractDNSToSwitchMapping {
|
|||
// reloadCachedMappings does nothing for StaticMapping; there is
|
||||
// nowhere to reload from since all data is in memory.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
// reloadCachedMappings does nothing for StaticMapping; there is
|
||||
// nowhere to reload from since all data is in memory.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,5 +120,9 @@ public class TestSwitchMapping extends Assert {
|
|||
@Override
|
||||
public void reloadCachedMappings() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -886,7 +886,12 @@ public class DatanodeManager {
|
|||
// If the network location is invalid, clear the cached mappings
|
||||
// so that we have a chance to re-add this DataNode with the
|
||||
// correct network location later.
|
||||
dnsToSwitchMapping.reloadCachedMappings();
|
||||
List<String> invalidNodeNames = new ArrayList<String>(3);
|
||||
// clear cache for nodes in IP or Hostname
|
||||
invalidNodeNames.add(nodeReg.getIpAddr());
|
||||
invalidNodeNames.add(nodeReg.getHostName());
|
||||
invalidNodeNames.add(nodeReg.getPeerHostName());
|
||||
dnsToSwitchMapping.reloadCachedMappings(invalidNodeNames);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,6 +99,10 @@ public class TestJobHistoryParsing {
|
|||
@Override
|
||||
public void reloadCachedMappings() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 50000)
|
||||
|
|
|
@ -215,6 +215,10 @@ public class TestAMRMClientContainerRequest {
|
|||
|
||||
@Override
|
||||
public void reloadCachedMappings() {}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
}
|
||||
}
|
||||
|
||||
private void verifyResourceRequest(
|
||||
|
|
|
@ -67,6 +67,10 @@ public class TestRackResolver {
|
|||
public void reloadCachedMappings() {
|
||||
// nothing to do here, since RawScriptBasedMapping has no cache.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadCachedMappings(List<String> names) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue