/** Test Methods */ synchronized Set<ReasonForBlackListing> getReasonForBlackList(String host) { FaultInfo fi = faultyTrackers.getFaultInfo(host, false); if (fi == null) { return new HashSet<ReasonForBlackListing>(); } return fi.getReasonforblacklisting(); }
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); } }
/** * Increments faults(blacklist by job) for the tracker by one. * * Adds the tracker to the potentially faulty list. * Assumes JobTracker is locked on the entry. * * @param hostName */ void incrementFaults(String hostName) { synchronized (potentiallyFaultyTrackers) { FaultInfo fi = getFaultInfo(hostName, true); long now = clock.getTime(); int numFaults = fi.getFaultCount(); ++numFaults; fi.setFaultCount(numFaults); fi.setLastUpdated(now); if (exceedsFaults(fi)) { LOG.info("Adding " + hostName + " to the blacklist" + " across all jobs"); String reason = String.format(FaultInfo.FAULT_FORMAT_STRING, numFaults); blackListTracker(hostName, reason, ReasonForBlackListing.EXCEEDING_FAILURES); } } }
/** * Increments faults(blacklist by job) for the tracker by one. * * Adds the tracker to the potentially faulty list. * Assumes JobTracker is locked on the entry. * * @param hostName */ void incrementFaults(String hostName, JobFault jf) { synchronized (potentiallyFaultyTrackers) { FaultInfo fi = getFaultInfo(hostName, true); fi.addFault(jf); fi.setLastUpdated(getClock().getTime()); if (exceedsFaults(fi)) { LOG.info("Adding " + hostName + " to the blacklist" + " across all jobs"); String reason = String.format(FaultInfo.FAULT_FORMAT_STRING, fi.getFaultCount()); blackListTracker(hostName, reason, ReasonForBlackListing.EXCEEDING_FAILURES); } } }
void setNodeHealthStatus(String hostName, boolean isHealthy, String reason) { FaultInfo fi = null; // If tracker is not healthy, create a fault info object // blacklist it. if (!isHealthy) { fi = getFaultInfo(hostName, true); fi.setHealthy(isHealthy); synchronized (potentiallyFaultyTrackers) { blackListTracker(hostName, reason, ReasonForBlackListing.NODE_UNHEALTHY); } } else { fi = getFaultInfo(hostName, false); if (fi == null) { return; } else { if (canUnBlackListTracker(hostName, ReasonForBlackListing.NODE_UNHEALTHY)) { unBlackListTracker(hostName, ReasonForBlackListing.NODE_UNHEALTHY); } } } } }
void setNodeHealthStatus(String hostName, boolean isHealthy, String reason) { FaultInfo fi = null; // If tracker is not healthy, create a fault info object // blacklist it. if (!isHealthy) { fi = getFaultInfo(hostName, true); fi.setHealthy(isHealthy); updateNodeHealthFailureStatistics(hostName, fi); synchronized (potentiallyFaultyTrackers) { blackListTracker(hostName, reason, ReasonForBlackListing.NODE_UNHEALTHY); } } else { fi = getFaultInfo(hostName, false); if (fi == null) { return; } else { if (canUnBlackListTracker(hostName, ReasonForBlackListing.NODE_UNHEALTHY)) { unBlackListTracker(hostName, ReasonForBlackListing.NODE_UNHEALTHY); } } } }
private void unBlackListTracker(String hostName, ReasonForBlackListing rfb) { // check if you can black list the tracker then call this methods FaultInfo fi = getFaultInfo(hostName, false); if(fi.removeBlackListedReason(rfb)) { if(fi.getReasonforblacklisting().isEmpty()) { addHostCapacity(hostName); LOG.info("Unblacklisting tracker : " + hostName); fi.unBlacklist(); //We have unBlackListed tracker, so tracker should //definitely be healthy. Check fault count if fault count //is zero don't keep it memory. if(fi.getFaultCount() == 0) { potentiallyFaultyTrackers.remove(hostName); } } } }
private void unBlackListTracker(String hostName, ReasonForBlackListing rfb) { // check if you can black list the tracker then call this methods FaultInfo fi = getFaultInfo(hostName, false); if (fi.removeBlackListedReason(rfb)) { if (fi.getReasonforblacklisting().isEmpty()) { addHostCapacity(hostName); LOG.info("Unblacklisting tracker : " + hostName); fi.unBlacklist(); //We have unBlackListed tracker, so tracker should //definitely be healthy. Check fault count if fault count //is zero don't keep it memory. if (fi.numFaults == 0) { potentiallyFaultyTrackers.remove(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); }
synchronized String getReasonsForBlacklisting(String host) { FaultInfo fi = faultyTrackers.getFaultInfo(host, false); if (fi == null) { return ""; } return fi.getTrackerFaultReport(); }