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

Method acknowledge

src/master/master.cpp:5833–5920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5831
5832
5833void Master::acknowledge(
5834 Framework* framework,
5835 scheduler::Call::Acknowledge&& acknowledge)
5836{
5837 CHECK_NOTNULL(framework);
5838
5839 metrics->messages_status_update_acknowledgement++;
5840
5841 const SlaveID& slaveId = acknowledge.slave_id();
5842 const TaskID& taskId = acknowledge.task_id();
5843
5844 Try<id::UUID> uuid_ = id::UUID::fromBytes(acknowledge.uuid());
5845 CHECK_SOME(uuid_);
5846 const id::UUID uuid = uuid_.get();
5847
5848 Slave* slave = slaves.registered.get(slaveId);
5849
5850 if (slave == nullptr) {
5851 LOG(WARNING)
5852 << "Cannot send status update acknowledgement for status " << uuid
5853 << " of task " << taskId << " of framework " << *framework
5854 << " to agent " << slaveId << " because agent is not registered";
5855
5856 metrics->invalid_status_update_acknowledgements++;
5857 return;
5858 }
5859
5860 if (!slave->connected) {
5861 LOG(WARNING)
5862 << "Cannot send status update acknowledgement for status " << uuid
5863 << " of task " << taskId << " of framework " << *framework
5864 << " to agent " << *slave << " because agent is disconnected";
5865
5866 metrics->invalid_status_update_acknowledgements++;
5867 return;
5868 }
5869
5870 LOG(INFO)
5871 << "Processing ACKNOWLEDGE call for status " << uuid
5872 << " for task " << taskId
5873 << " of framework " << *framework
5874 << " on agent " << slaveId;
5875
5876 Task* task = slave->getTask(framework->id(), taskId);
5877
5878 if (task != nullptr) {
5879 // Status update state and uuid should be either set or unset
5880 // together.
5881 CHECK_EQ(task->has_status_update_uuid(), task->has_status_update_state());
5882
5883 if (!task->has_status_update_state()) {
5884 // Task should have status update state set because it must have
5885 // been set when the update corresponding to this
5886 // acknowledgement was processed by the master. But in case this
5887 // acknowledgement was intended for the old run of the master
5888 // and the task belongs to a 0.20.0 slave, we could be here.
5889 // Dropping the acknowledgement is safe because the slave will
5890 // retry the update, at which point the master will set the

Callers 3

sendMethod · 0.45
validateFunction · 0.45
schedulerMethod · 0.45

Calls 5

isTerminalStateFunction · 0.85
sendFunction · 0.50
getMethod · 0.45
getTaskMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected