Repository: mesos
Updated Branches:
  refs/heads/master 0104e7349 -> 628ccd235


Fixed and illustrated process::initialize ordering.

Moves `metrics::initialize` below the creation of the `help` process.

Adds a comment block to explain the ordering of process creation in
`process::initialize`.

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


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

Branch: refs/heads/master
Commit: 628ccd23501078b04fb21eee85060a6226a80ef8
Parents: 0104e73
Author: Joseph Wu <jos...@mesosphere.io>
Authored: Mon May 9 13:14:18 2016 -0400
Committer: Joris Van Remoortere <joris.van.remoort...@gmail.com>
Committed: Mon May 9 13:14:50 2016 -0400

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 35 ++++++++++++++++++++++++++------
 1 file changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/628ccd23/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp 
b/3rdparty/libprocess/src/process.cpp
index dcaa646..a9bb27f 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -963,18 +963,41 @@ bool initialize(
   // process, and profiler always succeeds and use supervisors to make
   // sure that none terminate.
 
+  // For the global processes below, the order of initialization matters.
+  // Some global processes are necessary for the function of certain methods:
+  //
+  //   process | Underpins this method
+  //   --------|---------------------------
+  //   gc      | process::spawn(..., true)
+  //   help    | ProcessBase::route(...)
+  //   metrics | process::metrics::add(...)
+  //
+  // Due to the above, each global process must be started after the
+  // prerequisite global process(es) have been started. The following
+  // graph shows what processes depend on which other processes.
+  // Processes in the same vertical group can be safely started in any order.
+  //
+  //   gc
+  //   |--help
+  //   |  |--metrics
+  //   |  |  |--system
+  //   |  |  |--All other processes
+  //   |  |
+  //   |  |--logging
+  //   |  |--profiler
+  //   |  |--processesRoute
+  //   |
+  //   |--authentication_manager
+
   // Create global garbage collector process.
   gc = spawn(new GarbageCollector());
 
-  // Initialize the metrics process. We need to initialize this before the 
other
-  // global processes because `metrics::initialize` is also called when metrics
-  // are added in other initialization code, and we want this to be the first
-  // initialization in order to populate the authentication realm correctly.
-  metrics::initialize(authenticationRealm);
-
   // Create global help process.
   help = spawn(new Help(delegate), true);
 
+  // Initialize the global metrics process.
+  metrics::initialize(authenticationRealm);
+
   // Create the global logging process.
   spawn(new Logging(authenticationRealm), true);
 

Reply via email to