/** * Removes the tracker from blacklist and * from potentially faulty list, when it is restarted. * * Assumes JobTracker is locked on the entry. * * @param hostName */ void markTrackerHealthy(String hostName) { synchronized (potentiallyFaultyTrackers) { FaultInfo fi = potentiallyFaultyTrackers.remove(hostName); if (fi != null && fi.isBlacklisted()) { LOG.info("Removing " + hostName + " from blacklist"); addHostCapacity(hostName); } } }
/** * Whether a host is blacklisted across all the jobs. * * Assumes JobTracker is locked on the entry. * @param hostName * @return */ boolean isBlacklisted(String hostName) { synchronized (potentiallyFaultyTrackers) { FaultInfo fi = null; if ((fi = potentiallyFaultyTrackers.get(hostName)) != null) { return fi.isBlacklisted(); } } return false; }
/** * Whether a host is blacklisted across all the jobs. * * Assumes JobTracker is locked on the entry. * @param hostName * @return */ boolean isBlacklisted(String hostName) { synchronized (potentiallyFaultyTrackers) { FaultInfo fi = null; if ((fi = potentiallyFaultyTrackers.get(hostName)) != null) { return fi.isBlacklisted(); } } return false; }
return (fi != null && fi.isBlacklisted());
private void blackListTracker(String hostName, String reason, ReasonForBlackListing rfb) { FaultInfo fi = getFaultInfo(hostName, true); boolean blackListed = fi.isBlacklisted(); if (blackListed) { if (LOG.isDebugEnabled()) { LOG.debug("Adding blacklisted reason for tracker : " + hostName + " Reason for blacklisting is : " + rfb); } if (!fi.getReasonforblacklisting().contains(rfb)) { LOG.info("Adding blacklisted reason for tracker : " + hostName + " Reason for blacklisting is : " + rfb); } fi.addBlackListedReason(rfb, reason); } else { LOG.info("Blacklisting tracker : " + hostName + " Reason for blacklisting is : " + rfb); Set<TaskTracker> trackers = hostnameToTaskTracker.get(hostName); synchronized (trackers) { for (TaskTracker tracker : trackers) { tracker.cancelAllReservations(); } } removeHostCapacity(hostName); fi.setBlacklist(rfb, reason); } }
private void blackListTracker(String hostName, String reason, ReasonForBlackListing rfb) { FaultInfo fi = getFaultInfo(hostName, true); boolean blackListed = fi.isBlacklisted(); if(blackListed) { if (LOG.isDebugEnabled()) { LOG.debug("Adding blacklisted reason for tracker : " + hostName + " Reason for blacklisting is : " + rfb); } if (!fi.getReasonforblacklisting().contains(rfb)) { LOG.info("Adding blacklisted reason for tracker : " + hostName + " Reason for blacklisting is : " + rfb); } fi.addBlackListedReason(rfb, reason); } else { LOG.info("Blacklisting tracker : " + hostName + " Reason for blacklisting is : " + rfb); Set<TaskTracker> trackers = hostnameToTaskTracker.get(hostName); synchronized (trackers) { for (TaskTracker tracker : trackers) { tracker.cancelAllReservations(); } } removeHostCapacity(hostName); fi.setBlacklist(rfb, reason); } }
/** * Check whether tasks can be assigned to the tracker. * * One fault of the tracker is discarded if there * are no faults during one day. So, the tracker will get a * chance again to run tasks of a job. * Assumes JobTracker is locked on the entry. * * @param hostName The tracker name * @param now The current time * * @return true if the tracker is blacklisted * false otherwise */ boolean shouldAssignTasksToTracker(String hostName, long now) { synchronized (potentiallyFaultyTrackers) { FaultInfo fi = potentiallyFaultyTrackers.get(hostName); if (fi != null && (now - fi.getLastUpdated()) > UpdateFaultyTrackerInterval) { fi.forgiveOneFault(); fi.setLastUpdated(now); if (canUnBlackListTracker(hostName, ReasonForBlackListing.EXCEEDING_FAILURES)) { unBlackListTracker(hostName, ReasonForBlackListing.EXCEEDING_FAILURES); } } return (fi != null && fi.isBlacklisted()); } }
/** * Removes the tracker from blacklist and * from potentially faulty list, when it is restarted. * * Assumes JobTracker is locked on the entry. * * @param hostName */ void markTrackerHealthy(String hostName) { synchronized (potentiallyFaultyTrackers) { FaultInfo fi = potentiallyFaultyTrackers.remove(hostName); if (fi != null && fi.isBlacklisted()) { LOG.info("Removing " + hostName + " from blacklist"); addHostCapacity(hostName); } } }
private boolean canUnBlackListTracker(String hostName, ReasonForBlackListing rfb) { FaultInfo fi = getFaultInfo(hostName, false); if(fi == null) { return false; } Set<ReasonForBlackListing> rfbSet = fi.getReasonforblacklisting(); return fi.isBlacklisted() && rfbSet.contains(rfb); }
private boolean canUnBlackListTracker(String hostName, ReasonForBlackListing rfb) { FaultInfo fi = getFaultInfo(hostName, false); if (fi == null) { return false; } Set<ReasonForBlackListing> rfbSet = fi.getReasonforblacklisting(); return fi.isBlacklisted() && rfbSet.contains(rfb); }