Updated the master's status update handler to avoid unnecessary copying.

Previously, we took a copy in order to mutate the UUID within the
update if communicating with an agent prior to 0.26. We now no longer
need to copy the update.

Review: https://reviews.apache.org/r/65964


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0bbeac0c
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0bbeac0c
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0bbeac0c

Branch: refs/heads/master
Commit: 0bbeac0c821afa380af811b66aa541081cb33e22
Parents: a4e9695
Author: Benjamin Mahler <[email protected]>
Authored: Wed Mar 7 19:12:35 2018 -0800
Committer: Benjamin Mahler <[email protected]>
Committed: Fri Mar 9 12:36:13 2018 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 9 +++++----
 src/master/master.hpp | 3 +--
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/0bbeac0c/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index 381be8e..c89179c 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -859,9 +859,7 @@ void Master::initialize()
       &UnregisterSlaveMessage::slave_id);
 
   install<StatusUpdateMessage>(
-      &Master::statusUpdate,
-      &StatusUpdateMessage::update,
-      &StatusUpdateMessage::pid);
+      &Master::statusUpdate);
 
   // Added in 0.24.0 to support HTTP schedulers. Since
   // these do not have a pid, the slave must forward
@@ -7816,8 +7814,11 @@ void Master::updateUnavailability(
 // because the status updates will be sent by the slave.
 //
 // TODO(vinod): Add a benchmark test for status update handling.
-void Master::statusUpdate(StatusUpdate update, const UPID& pid)
+void Master::statusUpdate(StatusUpdateMessage&& statusUpdateMessage)
 {
+  const StatusUpdate& update = statusUpdateMessage.update();
+  const UPID& pid = statusUpdateMessage.pid();
+
   CHECK_NE(pid, UPID());
 
   ++metrics->messages_status_update;

http://git-wip-us.apache.org/repos/asf/mesos/blob/0bbeac0c/src/master/master.hpp
----------------------------------------------------------------------
diff --git a/src/master/master.hpp b/src/master/master.hpp
index a97fd08..df021ea 100644
--- a/src/master/master.hpp
+++ b/src/master/master.hpp
@@ -482,8 +482,7 @@ public:
       const SlaveID& slaveId);
 
   void statusUpdate(
-      StatusUpdate update,
-      const process::UPID& pid);
+      StatusUpdateMessage&& statusUpdateMessage);
 
   void reconcileTasks(
       const process::UPID& from,

Reply via email to