mesos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Mahler" <benjamin.mah...@gmail.com>
Subject Re: Review Request 14438: Re-structured the Slave::tasks map.
Date Wed, 02 Oct 2013 05:46:10 GMT


> On Oct. 2, 2013, 1:10 a.m., Vinod Kone wrote:
> > src/master/master.hpp, line 314
> > <https://reviews.apache.org/r/14438/diff/1/?file=360292#file360292line314>
> >
> >     what if framework_id itself is not present in the tasks map? Would this still
work?

Yep, tasks[task->framework_id()] will insert and return a new empty map in this case, so
the CHECK passes (and we'll always insert the framework id below). The alternative is a bit
more code:

CHECK(!tasks.contains(task->framework_id()) || !tasks[task->framework_id()].contains(task->task_id())));


> On Oct. 2, 2013, 1:10 a.m., Vinod Kone wrote:
> > src/master/master.hpp, line 329
> > <https://reviews.apache.org/r/14438/diff/1/?file=360292#file360292line329>
> >
> >     ditto.

In this case, if the framework id is not in the map, a new empty entry will be added and the
CHECK will fail as expected. For both these cases I could update them to check that the framework
id is present as well, but it's a bit more code. Any preference?

e.g.

CHECK(tasks.contains(task->framework_id()) && tasks[task->framework_id()].contains(task->task_id()));


- Ben


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


On Oct. 2, 2013, 12:38 a.m., Ben Mahler wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/14438/
> -----------------------------------------------------------
> 
> (Updated Oct. 2, 2013, 12:38 a.m.)
> 
> 
> Review request for mesos, Benjamin Hindman and Vinod Kone.
> 
> 
> Repository: mesos-git
> 
> 
> Description
> -------
> 
> Small cleanup, no functional change here. This changes the Slave::tasks:
> 
> hashmap<std::pair<FrameworkID, TaskID>, Task*> tasks; // Before.
> 
> hashmap<FrameworkID, hashmap<TaskID, Task*> > tasks;  // After.
> 
> 
> Diffs
> -----
> 
>   src/master/master.hpp bd5cb1ff05967518d7dc7f3a9dc0d32c22eb9643 
>   src/master/master.cpp a49b17ef43fca5b385a89731ca8776a26b61399a 
> 
> Diff: https://reviews.apache.org/r/14438/diff/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Ben Mahler
> 
>


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