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

Method statusUpdate

src/master/master.cpp:8117–8201  ·  view source on GitHub ↗

TODO(vinod): Since 0.22.0, we can use 'from' instead of 'pid' because the status updates will be sent by the slave. TODO(vinod): Add a benchmark test for status update handling.

Source from the content-addressed store, hash-verified

8115//
8116// TODO(vinod): Add a benchmark test for status update handling.
8117void Master::statusUpdate(StatusUpdateMessage&& statusUpdateMessage)
8118{
8119 const StatusUpdate& update = statusUpdateMessage.update();
8120 const UPID& pid = statusUpdateMessage.pid();
8121
8122 CHECK_NE(pid, UPID());
8123
8124 ++metrics->messages_status_update;
8125
8126 if (slaves.removed.get(update.slave_id()).isSome()) {
8127 // If the slave has been removed, drop the status update. The
8128 // master is no longer trying to health check this slave; when the
8129 // slave realizes it hasn't received any pings from the master, it
8130 // will eventually try to reregister.
8131 LOG(WARNING) << "Ignoring status update " << update
8132 << " from removed agent " << pid
8133 << " with id " << update.slave_id();
8134
8135 metrics->invalid_status_updates++;
8136 return;
8137 }
8138
8139 Slave* slave = slaves.registered.get(update.slave_id());
8140
8141 if (slave == nullptr) {
8142 LOG(WARNING) << "Ignoring status update " << update
8143 << " from unknown agent " << pid
8144 << " with id " << update.slave_id();
8145
8146 metrics->invalid_status_updates++;
8147 return;
8148 }
8149
8150 Try<id::UUID> uuid = id::UUID::fromBytes(update.uuid());
8151 if (uuid.isError()) {
8152 LOG(WARNING) << "Ignoring status update "
8153 << " from agent " << *slave
8154 << ": " << uuid.error();
8155
8156 ++metrics->invalid_status_updates;
8157 return;
8158 }
8159
8160 LOG(INFO) << "Status update " << update << " from agent " << *slave;
8161
8162 // Agents >= 0.26 should always correctly set task status uuid.
8163 CHECK(update.status().has_uuid());
8164
8165 bool validStatusUpdate = true;
8166
8167 Framework* framework = getFramework(update.framework_id());
8168
8169 // A framework might not have reregistered upon a master failover or
8170 // got disconnected.
8171 if (framework != nullptr && framework->connected()) {
8172 forward(update, pid, framework);
8173 } else {
8174 validStatusUpdate = false;

Callers

nothing calls this directly

Calls 10

errorMethod · 0.65
connectedMethod · 0.65
UPIDClass · 0.50
updateMethod · 0.45
pidMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45
isErrorMethod · 0.45
statusMethod · 0.45
getTaskMethod · 0.45

Tested by

no test coverage detected