mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guangya Liu <gyliu...@gmail.com>
Subject Review Request 52678: Fixed race for `calculateShare`.
Date Mon, 10 Oct 2016 08:05:56 GMT

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

Review request for mesos and Benjamin Mahler.


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


Repository: mesos


Description
-------

The `calculateShare` will be called to calculate the dominant
share metrics. There maybe a race that the `calculateShare` was
called when `removeFramework` finished removing the allocations
for one client. For such case, just return dominant share as 0.


Diffs
-----

  src/master/allocator/sorter/drf/sorter.cpp 790c9320f0c539b330e4fd1a9b608319f51992de 

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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message