mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinodk...@apache.org
Subject [8/8] mesos git commit: Skip registry update when nothing changed.
Date Tue, 05 Dec 2017 21:59:10 GMT
Skip registry update when nothing changed.

Most of the time, agents will not change their configuration
when they restart, so we can skip updating the registry in this
case.

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


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

Branch: refs/heads/master
Commit: 7b0812e9bf851b8baadadf1c1a95f3790a43d788
Parents: b612e9d
Author: Benno Evers <bevers@mesosphere.com>
Authored: Tue Dec 5 13:56:20 2017 -0800
Committer: Vinod Kone <vinodkone@gmail.com>
Committed: Tue Dec 5 13:58:52 2017 -0800

----------------------------------------------------------------------
 src/master/master.cpp | 54 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7b0812e9/src/master/master.cpp
----------------------------------------------------------------------
diff --git a/src/master/master.cpp b/src/master/master.cpp
index f9740e0..16cdde7 100644
--- a/src/master/master.cpp
+++ b/src/master/master.cpp
@@ -6582,9 +6582,11 @@ void Master::_reregisterSlave(
 
     // TODO(bevers): Verify that the checkpointed resources sent by the
     // slave match the ones stored in `slave`.
-    registrar->apply(Owned<Operation>(new UpdateSlave(slaveInfo)))
-      .onAny(defer(self(),
-          &Self::___reregisterSlave,
+
+    // Skip updating the registry if `slaveInfo` did not change from its
+    // previously known state.
+    if (slaveInfo == slave->info) {
+      ___reregisterSlave(
           slaveInfo,
           pid,
           executorInfos,
@@ -6593,17 +6595,35 @@ void Master::_reregisterSlave(
           version,
           agentCapabilities,
           resourceVersions,
-          lambda::_1));
-
+          true);
+    } else {
+      registrar->apply(Owned<Operation>(new UpdateSlave(slaveInfo)))
+        .onAny(defer(self(),
+            &Self::___reregisterSlave,
+            slaveInfo,
+            pid,
+            executorInfos,
+            tasks,
+            frameworks,
+            version,
+            agentCapabilities,
+            resourceVersions,
+            lambda::_1));
+    }
   } else if (slaves.recovered.contains(slaveInfo.id())) {
     // The agent likely is re-registering after a master failover as it
     // is in the list recovered from the registry.
     VLOG(1) << "Re-admitting recovered agent " << slaveInfo.id()
             << " at " << pid << "(" << slaveInfo.hostname() <<
")";
 
-    registrar->apply(Owned<Operation>(new UpdateSlave(slaveInfo)))
-      .onAny(defer(self(),
-          &Self::__reregisterSlave,
+    SlaveInfo recoveredInfo = slaves.recovered.at(slaveInfo.id());
+    convertResourceFormat(
+        recoveredInfo.mutable_resources(), POST_RESERVATION_REFINEMENT);
+
+    // Skip updating the registry if `slaveInfo` did not change from its
+    // previously known state (see also MESOS-7711).
+    if (slaveInfo == recoveredInfo) {
+      __reregisterSlave(
           slaveInfo,
           pid,
           checkpointedResources,
@@ -6614,7 +6634,23 @@ void Master::_reregisterSlave(
           version,
           agentCapabilities,
           resourceVersions,
-          lambda::_1));
+          true);
+    } else {
+      registrar->apply(Owned<Operation>(new UpdateSlave(slaveInfo)))
+        .onAny(defer(self(),
+            &Self::__reregisterSlave,
+            slaveInfo,
+            pid,
+            checkpointedResources,
+            executorInfos,
+            tasks,
+            frameworks,
+            completedFrameworks,
+            version,
+            agentCapabilities,
+            resourceVersions,
+            lambda::_1));
+    }
   } else {
     // In the common case, the slave has been marked unreachable
     // by the master, so we move the slave to the reachable list and


Mime
View raw message