| 102 | } |
| 103 | |
| 104 | void ExecutorBlacklist::Maintenance(std::list<BackendDescriptorPB>* probation_list) { |
| 105 | int64_t blacklist_timeout = GetBlacklistTimeoutMs(); |
| 106 | int64_t probation_timeout = blacklist_timeout * PROBATION_TIMEOUT_MULTIPLIER; |
| 107 | int64_t now = MonotonicMillis(); |
| 108 | auto entry_it = executor_list_.begin(); |
| 109 | while (entry_it != executor_list_.end()) { |
| 110 | Entry& entry = entry_it->second; |
| 111 | int64_t elapsed = now - entry.blacklist_time_ms; |
| 112 | if (entry.state == State::BLACKLISTED) { |
| 113 | // Check if we can take it off the blacklist and put it on probation. |
| 114 | if (elapsed > blacklist_timeout * entry.num_consecutive_blacklistings) { |
| 115 | LOG(INFO) << "Executor " << entry.be_desc.address() |
| 116 | << " passed the timeout and will be taken off the blacklist."; |
| 117 | probation_list->push_back(entry.be_desc); |
| 118 | entry.state = State::ON_PROBATION; |
| 119 | } |
| 120 | ++entry_it; |
| 121 | } else { |
| 122 | // Check if we can take it off probation. |
| 123 | if (elapsed > probation_timeout * entry.num_consecutive_blacklistings) { |
| 124 | entry_it = executor_list_.erase(entry_it); |
| 125 | } else { |
| 126 | ++entry_it; |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | VLOG(2) << "Completed blacklist maintenance. Current blacklist: " << DebugString(); |
| 131 | } |
| 132 | |
| 133 | bool ExecutorBlacklist::IsBlacklisted( |
| 134 | const BackendDescriptorPB& be_desc, Status* cause, int64_t* time_remaining_ms) const { |
no test coverage detected