MCPcopy Create free account
hub / github.com/apache/mesos / markUnreachable

Method markUnreachable

src/master/master.cpp:8559–8671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8557
8558
8559Future<bool> Master::markUnreachable(
8560 const SlaveInfo& slave,
8561 bool duringMasterFailover,
8562 const string& message)
8563{
8564 if (duringMasterFailover && !slaves.recovered.contains(slave.id())) {
8565 LOG(INFO) << "Skipping transition of agent"
8566 << " " << slave.id() << " (" << slave.hostname() << ")"
8567 << " to unreachable because it reregistered in the interim";
8568
8569 return false;
8570 }
8571
8572 if (!duringMasterFailover && !slaves.registered.contains(slave.id())) {
8573 // Possible when the `SlaveObserver` dispatches a message to
8574 // mark an unhealthy slave as unreachable, but the slave is
8575 // concurrently removed for another reason (e.g.,
8576 // `UnregisterSlaveMessage` is received).
8577 LOG(WARNING) << "Skipping transition of agent"
8578 << " " << slave.id() << " (" << slave.hostname() << ")"
8579 << " to unreachable because it has already been removed"
8580 << " or marked unreachable";
8581
8582 return false;
8583 }
8584
8585 // The slave might be in the process of reregistering without
8586 // the marking unreachable having been canceled.
8587 if (slaves.reregistering.contains(slave.id())) {
8588 LOG(INFO) << "Skipping transition of agent"
8589 << " " << slave.id() << " (" << slave.hostname() << ")"
8590 << " to unreachable because it is reregistering";
8591
8592 return false;
8593 }
8594
8595 if (slaves.markingUnreachable.contains(slave.id())) {
8596 // We might already be marking this slave unreachable. This is
8597 // possible if marking the slave unreachable in the registry takes
8598 // a long time. While the registry operation is in progress, the
8599 // `SlaveObserver` will continue to ping the slave; if the slave
8600 // fails another health check, the `SlaveObserver` will trigger
8601 // another attempt to mark it unreachable. Also possible if
8602 // `agentReregisterTimeout` marks the slave unreachable
8603 // concurrently with the slave observer doing so.
8604 LOG(WARNING) << "Skipping transition of agent"
8605 << " " << slave.id() << " (" << slave.hostname() << ")"
8606 << " to unreachable because another unreachable"
8607 << " transition is already in progress";
8608
8609 return false;
8610 }
8611
8612 if (slaves.removing.contains(slave.id())) {
8613 LOG(WARNING) << "Skipping transition of agent"
8614 << " " << slave.id() << " (" << slave.hostname() << ")"
8615 << " to unreachable because it is being removed";
8616

Callers

nothing calls this directly

Calls 12

getCurrentTimeFunction · 0.85
undiscardableFunction · 0.85
deferFunction · 0.85
insertMethod · 0.80
stringifyFunction · 0.50
bindFunction · 0.50
containsMethod · 0.45
idMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45
thenMethod · 0.45
applyMethod · 0.45

Tested by

no test coverage detected