|
@@ -86,7 +86,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
|
|
|
private DNSToSwitchMapping dnsToSwitchMapping;
|
|
|
private NetworkTopology clusterMap = new NetworkTopology();
|
|
|
- private ResolutionThread resThread = new ResolutionThread();
|
|
|
private int numTaskCacheLevels; // the max level to which we cache tasks
|
|
|
private Set<Node> nodesAtMaxLevel = new HashSet<Node>();
|
|
|
|
|
@@ -652,6 +651,11 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
this.localMachine = addr.getHostName();
|
|
|
this.port = addr.getPort();
|
|
|
int handlerCount = conf.getInt("mapred.job.tracker.handler.count", 10);
|
|
|
+
|
|
|
+ this.dnsToSwitchMapping = (DNSToSwitchMapping)ReflectionUtils.newInstance(
|
|
|
+ conf.getClass("topology.node.switch.mapping.impl", ScriptBasedMapping.class,
|
|
|
+ DNSToSwitchMapping.class), conf);
|
|
|
+
|
|
|
this.interTrackerServer = RPC.getServer(this, addr.getHostName(), addr.getPort(), handlerCount, false, conf);
|
|
|
this.interTrackerServer.start();
|
|
|
if (LOG.isDebugEnabled()) {
|
|
@@ -741,9 +745,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
infoServer.setAttribute("fileSys", historyFS);
|
|
|
}
|
|
|
|
|
|
- this.dnsToSwitchMapping = (DNSToSwitchMapping)ReflectionUtils.newInstance(
|
|
|
- conf.getClass("topology.node.switch.mapping.impl", ScriptBasedMapping.class,
|
|
|
- DNSToSwitchMapping.class), conf);
|
|
|
this.numTaskCacheLevels = conf.getInt("mapred.task.cache.levels",
|
|
|
NetworkTopology.DEFAULT_HOST_LEVEL);
|
|
|
synchronized (this) {
|
|
@@ -769,7 +770,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
this.expireTrackersThread = new Thread(this.expireTrackers,
|
|
|
"expireTrackers");
|
|
|
this.expireTrackersThread.start();
|
|
|
- this.resThread.start();
|
|
|
this.retireJobsThread = new Thread(this.retireJobs, "retireJobs");
|
|
|
this.retireJobsThread.start();
|
|
|
this.initJobsThread = new Thread(this.initJobs, "initJobs");
|
|
@@ -846,15 +846,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
ex.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- if (this.resThread != null) {
|
|
|
- LOG.info("Stopping DNSToSwitchMapping Resolution thread");
|
|
|
- this.resThread.interrupt();
|
|
|
- try {
|
|
|
- this.resThread.join();
|
|
|
- } catch (InterruptedException ex) {
|
|
|
- ex.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
if (this.completedJobsStoreThread != null &&
|
|
|
this.completedJobsStoreThread.isAlive()) {
|
|
|
LOG.info("Stopping completedJobsStore thread");
|
|
@@ -1287,6 +1278,12 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Register the tracker if its not registered
|
|
|
+ if (getNode(trackerName) == null) {
|
|
|
+ // Making the network location resolution inline ..
|
|
|
+ resolveAndAddToTopology(status.getHost());
|
|
|
+ }
|
|
|
+
|
|
|
// Process this heartbeat
|
|
|
short newResponseId = (short)(responseId + 1);
|
|
|
if (!processHeartbeat(status, initialContact)) {
|
|
@@ -1453,7 +1450,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
|
|
|
if (initialContact) {
|
|
|
trackerExpiryQueue.add(trackerStatus);
|
|
|
- resThread.addToResolutionQueue(trackerStatus);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1463,64 +1459,6 @@ public class JobTracker implements MRConstants, InterTrackerProtocol, JobSubmiss
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private class ResolutionThread extends Thread {
|
|
|
- private LinkedBlockingQueue<TaskTrackerStatus> queue =
|
|
|
- new LinkedBlockingQueue <TaskTrackerStatus>();
|
|
|
- public ResolutionThread() {
|
|
|
- setName("DNSToSwitchMapping reolution Thread");
|
|
|
- setDaemon(true);
|
|
|
- }
|
|
|
- public void addToResolutionQueue(TaskTrackerStatus t) {
|
|
|
- while (!queue.add(t)) {
|
|
|
- LOG.warn("Couldn't add to the Resolution queue now. Will " +
|
|
|
- "try again");
|
|
|
- try {
|
|
|
- Thread.sleep(2000);
|
|
|
- } catch (InterruptedException ie) {}
|
|
|
- }
|
|
|
- }
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- while (!isInterrupted()) {
|
|
|
- try {
|
|
|
- List <TaskTrackerStatus> statuses =
|
|
|
- new ArrayList<TaskTrackerStatus>(queue.size());
|
|
|
- // Block if the queue is empty
|
|
|
- statuses.add(queue.take());
|
|
|
- queue.drainTo(statuses);
|
|
|
- List<String> dnHosts = new ArrayList<String>(statuses.size());
|
|
|
- for (TaskTrackerStatus t : statuses) {
|
|
|
- dnHosts.add(t.getHost());
|
|
|
- }
|
|
|
- List<String> rName = dnsToSwitchMapping.resolve(dnHosts);
|
|
|
- if (rName == null) {
|
|
|
- LOG.error("The resolve call returned null! Using " +
|
|
|
- NetworkTopology.DEFAULT_RACK + " for some hosts");
|
|
|
- rName = new ArrayList<String>(dnHosts.size());
|
|
|
- for (int i = 0; i < dnHosts.size(); i++) {
|
|
|
- rName.add(NetworkTopology.DEFAULT_RACK);
|
|
|
- }
|
|
|
- }
|
|
|
- int i = 0;
|
|
|
- for (String m : rName) {
|
|
|
- String host = statuses.get(i++).getHost();
|
|
|
- String networkLoc = NodeBase.normalize(m);
|
|
|
- addHostToNodeMapping(host, networkLoc);
|
|
|
- numResolved++;
|
|
|
- }
|
|
|
- } catch (InterruptedException ie) {
|
|
|
- LOG.warn(getName() + " exiting, got interrupted: " +
|
|
|
- StringUtils.stringifyException(ie));
|
|
|
- return;
|
|
|
- } catch (Throwable t) {
|
|
|
- LOG.error(getName() + " got an exception: " +
|
|
|
- StringUtils.stringifyException(t));
|
|
|
- }
|
|
|
- }
|
|
|
- LOG.warn(getName() + " exiting...");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Returns a task we'd like the TaskTracker to execute right now.
|
|
|
*
|