mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiang Yan Xu <...@jxu.me>
Subject Re: Review Request 63741: Fixed a bug in devolving framework subscription with suppressed roles.
Date Fri, 01 Dec 2017 22:36:03 GMT


> On Nov. 21, 2017, 10:04 a.m., Alexander Rukletsov wrote:
> > src/internal/devolve.cpp
> > Lines 203-204 (patched)
> > <https://reviews.apache.org/r/63741/diff/1/?file=1892879#file1892879line203>
> >
> >     I believe we prefer writing `CopyFrom()` explicitly, no?
> 
> Jiang Yan Xu wrote:
>     I don't think it's estalished as a rule even though we do use CopyFrom most often
previously. Now that we have upgraded to protobuf 3.5 with move semantics, I think we can
probably standarize on prefering the assignment operator as the choice between copy and move
can be determined simply by the rvalue-ness of the operand unless copying is explicitly intended.
I understand that this particular case wouldn't be moved but styling wise it's more futre-proof.
We should further this discussion. For now I think this is OK as this style is already used
in the codebase.
> 
> Alexander Rukletsov wrote:
>     I didn't know `CopyFrom` and `operator=` can behave differently in proto 3.5. Could
you please point me to that code to broaden my horizons?

Take `Resource` as an example, the generated code now contains:

```
  #if LANG_CXX11
  Resource(Resource&& from) noexcept
    : Resource() {
    *this = ::std::move(from);
  }

  inline Resource& operator=(Resource&& from) noexcept {
    if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
      if (this != &from) InternalSwap(&from);
    } else {
      CopyFrom(from);
    }
    return *this;
  }
  #endif
```

thanks to changes in https://github.com/google/protobuf/releases/tag/v3.5.0 and https://github.com/google/protobuf/releases/tag/v3.4.0.

But again, it wouldn't help with the current code, just styling and future-proofness difference.


- Jiang Yan


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


On Nov. 27, 2017, 4:29 p.m., Jiang Yan Xu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/63741/
> -----------------------------------------------------------
> 
> (Updated Nov. 27, 2017, 4:29 p.m.)
> 
> 
> Review request for mesos and Alexander Rukletsov.
> 
> 
> Bugs: MESOS-8200
>     https://issues.apache.org/jira/browse/MESOS-8200
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Also improved logging to show the suppressed roles.
> 
> 
> Diffs
> -----
> 
>   src/internal/devolve.cpp 3a02490d734ef4a558b448871f9a1054d832f457 
>   src/internal/evolve.cpp cb1c0eb0908b05ef4f14462f6cf704a9151ea875 
>   src/master/master.cpp 53263e499d88b906b6406c24c0dfb737e589e813 
> 
> 
> Diff: https://reviews.apache.org/r/63741/diff/2/
> 
> 
> Testing
> -------
> 
> Tested together with /r/63830/.
> 
> 
> Thanks,
> 
> Jiang Yan Xu
> 
>


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