You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by James Peach <jp...@apache.org> on 2017/04/10 15:49:21 UTC

Review Request 58304: Remove unnecessary hashmap lookups.

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

Review request for mesos.


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


Repository: mesos


Description
-------

In a number of places, we tested whether the slaves hashmap contains
the desired element before indexing it. It is safe to just index it and
check for a NULL result, which saves us some hashing and lookups.


Diffs
-----

  src/master/master.cpp c1f3c4f3bbcbfb10ae8fc974bd4a16ec070a79fd 


Diff: https://reviews.apache.org/r/58304/diff/1/


Testing
-------

Make check (Fedora 25). Internal fuzzing.


Thanks,

James Peach


Re: Review Request 58304: Remove unnecessary hashmap lookups.

Posted by Adam B <ad...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58304/#review171532
-----------------------------------------------------------


Fix it, then Ship it!




LGTM, minor tweak to a log message


src/master/master.cpp
Lines 6429-6431 (original), 6433-6435 (patched)
<https://reviews.apache.org/r/58304/#comment244479>

    s/shutdown.executor_id()/executorId/
    s/shutdown.slave_id()/slaveId/
    (now that you have them already)


- Adam B


On April 10, 2017, 8:50 a.m., James Peach wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58304/
> -----------------------------------------------------------
> 
> (Updated April 10, 2017, 8:50 a.m.)
> 
> 
> Review request for mesos and Mesos Reviewbot.
> 
> 
> Bugs: MESOS-7372
>     https://issues.apache.org/jira/browse/MESOS-7372
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In a number of places, we tested whether the slaves hashmap contains
> the desired element before indexing it. It is safe to just index it and
> check for a NULL result, which saves us some hashing and lookups.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp c1f3c4f3bbcbfb10ae8fc974bd4a16ec070a79fd 
> 
> 
> Diff: https://reviews.apache.org/r/58304/diff/1/
> 
> 
> Testing
> -------
> 
> Make check (Fedora 25). Internal fuzzing.
> 
> 
> Thanks,
> 
> James Peach
> 
>


Re: Review Request 58304: Remove unnecessary hashmap lookups.

Posted by Neil Conway <ne...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58304/#review171614
-----------------------------------------------------------



For consistency, should we also remove the `CHECK(slaves.registered.contains(slaveId))` in `Master::updateUnavailability`?


src/master/master.cpp
Line 1314 (original), 1314 (patched)
<https://reviews.apache.org/r/58304/#comment244573>

    Seems a bit implicit to me, but I guess it's fine.
    
    If we're going to make this change, can you also update the `slaves.registered.get()` call at line 5591 (inside `Master::reregisterSlave`) to move the `slave` variable inside the scope of the `if`?



src/master/master.cpp
Lines 5276 (patched)
<https://reviews.apache.org/r/58304/#comment244568>

    Unintended whitespace change.



src/master/master.cpp
Line 6113 (original), 6111 (patched)
<https://reviews.apache.org/r/58304/#comment244557>

    I'd prefer to remove this `CHECK_NOTNULL`, because it is implied by the control flow of the function. i.e., I think `CHECK_NOTNULL` is useful when it documents a function's preconditions, but in this case it is redundant with the function's internal control flow.



src/master/master.cpp
Line 6381 (original), 6380 (patched)
<https://reviews.apache.org/r/58304/#comment244559>

    Ibid.



src/master/master.cpp
Line 6439 (original), 6440 (patched)
<https://reviews.apache.org/r/58304/#comment244560>

    Ibid.



src/master/master.cpp
Line 6986 (original), 6988 (patched)
<https://reviews.apache.org/r/58304/#comment244561>

    Ibid.



src/master/master.cpp
Line 7131 (original), 7134 (patched)
<https://reviews.apache.org/r/58304/#comment244562>

    Ibid.


- Neil Conway


On April 11, 2017, 4:27 p.m., James Peach wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58304/
> -----------------------------------------------------------
> 
> (Updated April 11, 2017, 4:27 p.m.)
> 
> 
> Review request for mesos and Mesos Reviewbot.
> 
> 
> Bugs: MESOS-7372
>     https://issues.apache.org/jira/browse/MESOS-7372
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> In a number of places, we tested whether the slaves hashmap contains
> the desired element before indexing it. It is safe to just index it and
> check for a NULL result, which saves us some hashing and lookups.
> 
> 
> Diffs
> -----
> 
>   src/master/master.cpp c1f3c4f3bbcbfb10ae8fc974bd4a16ec070a79fd 
> 
> 
> Diff: https://reviews.apache.org/r/58304/diff/2/
> 
> 
> Testing
> -------
> 
> Make check (Fedora 25). Internal fuzzing.
> 
> 
> Thanks,
> 
> James Peach
> 
>


Re: Review Request 58304: Remove unnecessary hashmap lookups.

Posted by James Peach <jp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58304/
-----------------------------------------------------------

(Updated April 11, 2017, 4:27 p.m.)


Review request for mesos and Mesos Reviewbot.


Changes
-------

Rebased and addresses review feedback.


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


Repository: mesos


Description
-------

In a number of places, we tested whether the slaves hashmap contains
the desired element before indexing it. It is safe to just index it and
check for a NULL result, which saves us some hashing and lookups.


Diffs (updated)
-----

  src/master/master.cpp c1f3c4f3bbcbfb10ae8fc974bd4a16ec070a79fd 


Diff: https://reviews.apache.org/r/58304/diff/2/

Changes: https://reviews.apache.org/r/58304/diff/1-2/


Testing
-------

Make check (Fedora 25). Internal fuzzing.


Thanks,

James Peach


Re: Review Request 58304: Remove unnecessary hashmap lookups.

Posted by James Peach <jp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58304/
-----------------------------------------------------------

(Updated April 10, 2017, 3:50 p.m.)


Review request for mesos and Mesos Reviewbot.


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


Repository: mesos


Description
-------

In a number of places, we tested whether the slaves hashmap contains
the desired element before indexing it. It is safe to just index it and
check for a NULL result, which saves us some hashing and lookups.


Diffs
-----

  src/master/master.cpp c1f3c4f3bbcbfb10ae8fc974bd4a16ec070a79fd 


Diff: https://reviews.apache.org/r/58304/diff/1/


Testing
-------

Make check (Fedora 25). Internal fuzzing.


Thanks,

James Peach