mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Zhuk <dz...@twopensource.com>
Subject Re: Review Request 63914: Changed agent reregistration to work with message directly.
Date Tue, 05 Dec 2017 15:02:50 GMT


> On Dec. 4, 2017, 9:18 p.m., Benjamin Mahler wrote:
> > src/master/master.cpp
> > Lines 6492-6499 (patched)
> > <https://reviews.apache.org/r/63914/diff/4/?file=1904566#file1904566line6536>
> >
> >     Hm.. I'm curious if you have any thoughts on avoiding copying it out of the
message. We can look at that more closely in a different patch though :)

Simplest solution is to add
```
template <typename T>
std::vector<T> convert(google::protobuf::RepeatedPtrField<T>&& items)
```
and use it like this:
```
vector<Task> tasks = google::protobuf::convert(std::move(*message.mutable_tasks()));
```
but the problem is that it becomes difficult to track which parts of the message have been
moved from. And I suppose `clang-tidy` will not be able to detect "use after move" in such
case. So I haven't published this patch.
I was thinking about decomposing a message with moves and invoking continuation method with
all individual message fields as parameters to make sure message goes out of scope, but I
haven't tried this yet.

In many cases it's possible to avoid using `convert`, and use `RepeatedPtrField` instead.
I did this for `tasks`, but the problem is still the same - difficult to track moved message
parts.


- Dmitry


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


On Nov. 21, 2017, 5:53 p.m., Dmitry Zhuk wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/63914/
> -----------------------------------------------------------
> 
> (Updated Nov. 21, 2017, 5:53 p.m.)
> 
> 
> Review request for mesos, Benjamin Mahler and Michael Park.
> 
> 
> Bugs: MESOS-6972
>     https://issues.apache.org/jira/browse/MESOS-6972
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> `reregisterSlave` now accepts `ReregisterSlaveMessage&&`, which opts-out
> of using protobuf arena, and allows passing message through dispatch
> chain without making any copies.
> Conversion of repeated message fields to `std::vector`s is performed
> only when needed.
> 
> 
> Diffs
> -----
> 
>   src/master/master.hpp 0f8a2ac72c3484f911853c2994fc71a488d66d96 
>   src/master/master.cpp fadc78b2ca5d46b8cc12a794b428753aa79ac095 
>   src/master/validation.hpp ac54062ea09f97ad96bd17deb106ea89a57f394a 
>   src/master/validation.cpp 8b5848bfd8c069f34a92a9a68597955c6e0c2ee2 
>   src/tests/master_validation_tests.cpp 0e1c8b490ebe10bc50b8b6b530fa85128b967584 
> 
> 
> Diff: https://reviews.apache.org/r/63914/diff/4/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Dmitry Zhuk
> 
>


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