-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/52678/
-----------------------------------------------------------

(Updated 十月 12, 2016, 1:50 a.m.)


Review request for mesos and Benjamin Mahler.


Summary (updated)
-----------------

Fixed race in getting metrics for dominant share.


Bugs: MESOS-6308
    https://issues.apache.org/jira/browse/MESOS-6308


Repository: mesos


Description (updated)
-------

When calculate share for dominant share metrics, the client
may have been removed if the dispatch occurs after the client
is removed but before the metric is removed.

The fix is checking if client exist or not before calculate
share for dominant share metrics.


Diffs (updated)
-----

  src/master/allocator/sorter/drf/metrics.cpp 
baede07c7303403e42f0d6e1ff8dae9ee1953069 

Diff: https://reviews.apache.org/r/52678/diff/


Testing
-------

make
make check

Also hacked the code as desribed in `MESOS-6308` to test.

1)
```
--- a/src/master/allocator/sorter/drf/sorter.cpp
+++ b/src/master/allocator/sorter/drf/sorter.cpp
@@ -28,6 +28,7 @@
 #include <stout/check.hpp>
 #include <stout/foreach.hpp>
 #include <stout/option.hpp>
+#include <stout/os.hpp>

 #include "logging/logging.hpp"

@@ -110,6 +111,8 @@ void DRFSorter::remove(const string& name)
   allocations.erase(name);
   weights.erase(name);

+  os::sleep(Seconds(1));
+
   if (metrics.isSome()) {
     metrics->remove(name);
   }
```

2)
```
./bin/mesos-tests.sh --gtest_filter="PartitionTest.DisconnectedFramework"
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from PartitionTest
[ RUN      ] PartitionTest.DisconnectedFramework
I1010 16:04:43.032400 283824128 exec.cpp:162] Version: 1.1.0
I1010 16:04:43.036418 287043584 exec.cpp:237] Executor registered on agent 
8913c19c-fda2-4cbd-b2c8-283fc6839117-S0
Received SUBSCRIBED event
Subscribed executor on 192.168.56.1
Received LAUNCH event
Starting task 8d6709f4-8668-4ab7-b7b9-2d111bf15c7d
/Users/gyliu/git/mesos/build/src/mesos-containerizer launch 
--command="{"shell":true,"value":"sleep 60"}" --help="false"
Forked command at 263
[       OK ] PartitionTest.DisconnectedFramework (4497 ms)
[----------] 1 test from PartitionTest (4498 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (4509 ms total)
[  PASSED  ] 1 test.
```


Thanks,

Guangya Liu

Reply via email to