Source:
private void failNextHost() { Pair<String, FailState> hostToFail = hostFailState.nextHostToFail(); if (hostToFail != null) { String failedHostUuid = hostToFail.getLeft(); FailState failState = hostToFail.getRight(); if (failState == FailState.FAILING_FS_DEAD) { markHostDead(failedHostUuid); HostLocation location = spawn.hostManager.getHostState(failedHostUuid).getHostLocation(); spawn.getSpawnBalancer().fixTasksForFailedHost(spawn.hostManager.listHostStatus(null), failedHostUuid); } else { HostState host = spawn.hostManager.getHostState(failedHostUuid); if (host == null) { markHostDead(failedHostUuid); return; } boolean diskFull = (failState == FailState.DISK_FULL); if (!diskFull && spawn.getSystemManager().isQuiesced()) { return; } int taskMovingMax = diskFull ? maxMovingTasksDiskFull : maxMovingTasks; int tasksRebalancing = countRebalancingTasks(); int tasksToMove = taskMovingMax - tasksRebalancing; if (tasksToMove <= 0) { return; } List<JobTaskMoveAssignment> assignments = spawn.getSpawnBalancer().pushTasksOffHostForFilesystemOkayFailure(host, tasksToMove); if(assignments.isEmpty() && tasksRebalancing == 0 && failState == FailState.FAILING_FS_OKAY) { hostFailState.removeHost(failedHostUuid); hostFailState.putHost(failedHostUuid, FailState.FAILING_FS_OKAY); } spawn.executeReallocationAssignments(assignments, !diskFull && obeyTaskSlots.get()); if (failState == FailState.FAILING_FS_OKAY && assignments.isEmpty() && host.countTotalLive() == 0) { markHostDead(failedHostUuid); HostLocation location = spawn.hostManager.getHostState(failedHostUuid).getHostLocation(); spawn.getSpawnBalancer().fixTasksForFailedHost( spawn.hostManager.listHostStatus(host.getMinionTypes()), failedHostUuid); } } } }

Target:
private void failNextHost() { Pair<String, FailState> hostToFail = hostFailState.nextHostToFail(); if (hostToFail != null) { String failedHostUuid = hostToFail.getLeft(); FailState failState = hostToFail.getRight(); if (failState == FailState.FAILING_FS_DEAD) { markHostDead(failedHostUuid); spawn.getSpawnBalancer().fixTasksForFailedHost(spawn.hostManager.listHostStatus(null), failedHostUuid); } else { HostState host = spawn.hostManager.getHostState(failedHostUuid); if (host == null) { markHostDead(failedHostUuid); return; } boolean diskFull = (failState == FailState.DISK_FULL); if (!diskFull && spawn.getSystemManager().isQuiesced()) { return; } int taskMovingMax = diskFull ? maxMovingTasksDiskFull : maxMovingTasks; int tasksRebalancing = countRebalancingTasks(); int tasksToMove = taskMovingMax - tasksRebalancing; if (tasksToMove <= 0) { return; } List<JobTaskMoveAssignment> assignments = spawn.getSpawnBalancer().pushTasksOffHostForFilesystemOkayFailure(host, tasksToMove); if(assignments.isEmpty() && tasksRebalancing == 0 && failState == FailState.FAILING_FS_OKAY) { hostFailState.removeHost(failedHostUuid); hostFailState.putHost(failedHostUuid, FailState.FAILING_FS_OKAY); } spawn.executeReallocationAssignments(assignments, !diskFull && obeyTaskSlots.get()); if (failState == FailState.FAILING_FS_OKAY && assignments.isEmpty() && host.countTotalLive() == 0) { markHostDead(failedHostUuid); spawn.getSpawnBalancer().fixTasksForFailedHost( spawn.hostManager.listHostStatus(host.getMinionTypes()), failedHostUuid); } } } }