You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Greg Mann <gr...@mesosphere.io> on 2016/01/25 22:02:16 UTC

Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

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

Review request for mesos, Jie Yu, Michael Park, and Neil Conway.


Repository: mesos


Description
-------

Added checks for presence of `ReservationInfo.principal`.

The `ReservationInfo.principal` field was recently made `optional`. During the deprecation cycle, requests that do not have the field set are invalidated and rejected. However, there remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.


Diffs
-----

  src/common/resources.cpp 0fcf86014ab5c9908a1cdb3a57b7c5e70acd7737 
  src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
  src/v1/resources.cpp 126e5a2f567d2e281da3f99bc485f7960567eee5 

Diff: https://reviews.apache.org/r/42733/diff/


Testing
-------

`make check`


Thanks,

Greg Mann


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Vinod Kone <vi...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42733/#review120971
-----------------------------------------------------------


Fix it, then Ship it!





src/common/resources.cpp (line 68)
<https://reviews.apache.org/r/42733/#comment182524>

    no need for else if, just do an if.



src/v1/resources.cpp (line 70)
<https://reviews.apache.org/r/42733/#comment182525>

    ditto.


- Vinod Kone


On Feb. 26, 2016, 6:31 p.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42733/
> -----------------------------------------------------------
> 
> (Updated Feb. 26, 2016, 6:31 p.m.)
> 
> 
> Review request for mesos, Michael Park, Neil Conway, and Vinod Kone.
> 
> 
> Bugs: MESOS-3940
>     https://issues.apache.org/jira/browse/MESOS-3940
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added checks for presence of `ReservationInfo.principal`.
> 
> The `ReservationInfo.principal` field was recently made `optional`. There remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 5d731870542166cec11f9956ccdf16207b2d22cc 
>   src/master/master.cpp 8d6d3c6468c6b85fe09c33cf9747cc3d1f515ab9 
>   src/v1/resources.cpp 207eb61d6a6d03d314539d42751cac65fcffa9af 
> 
> Diff: https://reviews.apache.org/r/42733/diff/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Greg Mann
> 
>


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42733/#review120954
-----------------------------------------------------------



Patch looks great!

Reviews applied: [42733]

Passed command: export OS='ubuntu:14.04' CONFIGURATION='--verbose' COMPILER='gcc' ENVIRONMENT='GLOG_v=1 MESOS_VERBOSE=1'; ./support/docker_build.sh

- Mesos ReviewBot


On Feb. 26, 2016, 6:31 p.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42733/
> -----------------------------------------------------------
> 
> (Updated Feb. 26, 2016, 6:31 p.m.)
> 
> 
> Review request for mesos, Michael Park, Neil Conway, and Vinod Kone.
> 
> 
> Bugs: MESOS-3940
>     https://issues.apache.org/jira/browse/MESOS-3940
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added checks for presence of `ReservationInfo.principal`.
> 
> The `ReservationInfo.principal` field was recently made `optional`. There remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 5d731870542166cec11f9956ccdf16207b2d22cc 
>   src/master/master.cpp 8d6d3c6468c6b85fe09c33cf9747cc3d1f515ab9 
>   src/v1/resources.cpp 207eb61d6a6d03d314539d42751cac65fcffa9af 
> 
> Diff: https://reviews.apache.org/r/42733/diff/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Greg Mann
> 
>


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42733/#review120997
-----------------------------------------------------------


Ship it!




Ship It!

- Michael Park


On Feb. 26, 2016, 10:21 p.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42733/
> -----------------------------------------------------------
> 
> (Updated Feb. 26, 2016, 10:21 p.m.)
> 
> 
> Review request for mesos, Michael Park, Neil Conway, and Vinod Kone.
> 
> 
> Bugs: MESOS-3940
>     https://issues.apache.org/jira/browse/MESOS-3940
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added checks for presence of `ReservationInfo.principal`.
> 
> The `ReservationInfo.principal` field was recently made `optional`. There remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 5d731870542166cec11f9956ccdf16207b2d22cc 
>   src/master/master.cpp 8d6d3c6468c6b85fe09c33cf9747cc3d1f515ab9 
>   src/v1/resources.cpp 207eb61d6a6d03d314539d42751cac65fcffa9af 
> 
> Diff: https://reviews.apache.org/r/42733/diff/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Greg Mann
> 
>


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Greg Mann <gr...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42733/
-----------------------------------------------------------

(Updated Feb. 26, 2016, 10:21 p.m.)


Review request for mesos, Michael Park, Neil Conway, and Vinod Kone.


Changes
-------

Addressed comment.


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


Repository: mesos


Description
-------

Added checks for presence of `ReservationInfo.principal`.

The `ReservationInfo.principal` field was recently made `optional`. There remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.


Diffs (updated)
-----

  src/common/resources.cpp 5d731870542166cec11f9956ccdf16207b2d22cc 
  src/master/master.cpp 8d6d3c6468c6b85fe09c33cf9747cc3d1f515ab9 
  src/v1/resources.cpp 207eb61d6a6d03d314539d42751cac65fcffa9af 

Diff: https://reviews.apache.org/r/42733/diff/


Testing
-------

`make check`


Thanks,

Greg Mann


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Greg Mann <gr...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42733/
-----------------------------------------------------------

(Updated Feb. 26, 2016, 6:31 p.m.)


Review request for mesos, Michael Park, Neil Conway, and Vinod Kone.


Changes
-------

Rebased.


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


Repository: mesos


Description
-------

Added checks for presence of `ReservationInfo.principal`.

The `ReservationInfo.principal` field was recently made `optional`. There remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.


Diffs
-----

  src/common/resources.cpp 5d731870542166cec11f9956ccdf16207b2d22cc 
  src/master/master.cpp 8d6d3c6468c6b85fe09c33cf9747cc3d1f515ab9 
  src/v1/resources.cpp 207eb61d6a6d03d314539d42751cac65fcffa9af 

Diff: https://reviews.apache.org/r/42733/diff/


Testing
-------

`make check`


Thanks,

Greg Mann


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Greg Mann <gr...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42733/
-----------------------------------------------------------

(Updated Feb. 26, 2016, 6:30 p.m.)


Review request for mesos, Jie Yu, Michael Park, and Neil Conway.


Changes
-------

Rebased.


Repository: mesos


Description (updated)
-------

Added checks for presence of `ReservationInfo.principal`.

The `ReservationInfo.principal` field was recently made `optional`. There remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.


Diffs (updated)
-----

  src/common/resources.cpp 5d731870542166cec11f9956ccdf16207b2d22cc 
  src/master/master.cpp 8d6d3c6468c6b85fe09c33cf9747cc3d1f515ab9 
  src/v1/resources.cpp 207eb61d6a6d03d314539d42751cac65fcffa9af 

Diff: https://reviews.apache.org/r/42733/diff/


Testing
-------

`make check`


Thanks,

Greg Mann


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42733/#review116196
-----------------------------------------------------------



Patch looks great!

Reviews applied: [42733]

Passed command: export OS=ubuntu:14.04;export CONFIGURATION="--verbose";export COMPILER=gcc; ./support/docker_build.sh

- Mesos ReviewBot


On Jan. 25, 2016, 9:02 p.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42733/
> -----------------------------------------------------------
> 
> (Updated Jan. 25, 2016, 9:02 p.m.)
> 
> 
> Review request for mesos, Jie Yu, Michael Park, and Neil Conway.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added checks for presence of `ReservationInfo.principal`.
> 
> The `ReservationInfo.principal` field was recently made `optional`. During the deprecation cycle, requests that do not have the field set are invalidated and rejected. However, there remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 0fcf86014ab5c9908a1cdb3a57b7c5e70acd7737 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/v1/resources.cpp 126e5a2f567d2e281da3f99bc485f7960567eee5 
> 
> Diff: https://reviews.apache.org/r/42733/diff/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Greg Mann
> 
>


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

Posted by Greg Mann <gr...@mesosphere.io>.

> On Jan. 25, 2016, 9:05 p.m., Neil Conway wrote:
> > src/common/resources.cpp, line 66
> > <https://reviews.apache.org/r/42733/diff/1/?file=1219795#file1219795line66>
> >
> >     This is actually correct as written, no? i.e., if principal isn't set, `principal()` will return the empty string. Since an empty string isn't a legal principle, the comparison should just work, I believe.

I believe we allow the empty string as a valid principal.


- Greg


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


On Jan. 25, 2016, 9:02 p.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42733/
> -----------------------------------------------------------
> 
> (Updated Jan. 25, 2016, 9:02 p.m.)
> 
> 
> Review request for mesos, Jie Yu, Michael Park, and Neil Conway.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added checks for presence of `ReservationInfo.principal`.
> 
> The `ReservationInfo.principal` field was recently made `optional`. During the deprecation cycle, requests that do not have the field set are invalidated and rejected. However, there remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 0fcf86014ab5c9908a1cdb3a57b7c5e70acd7737 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/v1/resources.cpp 126e5a2f567d2e281da3f99bc485f7960567eee5 
> 
> Diff: https://reviews.apache.org/r/42733/diff/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Greg Mann
> 
>


Re: Review Request 42733: Added checks for presence of `ReservationInfo.principal`.

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




src/common/resources.cpp (line 66)
<https://reviews.apache.org/r/42733/#comment177166>

    This is actually correct as written, no? i.e., if principal isn't set, `principal()` will return the empty string. Since an empty string isn't a legal principle, the comparison should just work, I believe.


- Neil Conway


On Jan. 25, 2016, 9:02 p.m., Greg Mann wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42733/
> -----------------------------------------------------------
> 
> (Updated Jan. 25, 2016, 9:02 p.m.)
> 
> 
> Review request for mesos, Jie Yu, Michael Park, and Neil Conway.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added checks for presence of `ReservationInfo.principal`.
> 
> The `ReservationInfo.principal` field was recently made `optional`. During the deprecation cycle, requests that do not have the field set are invalidated and rejected. However, there remain a couple places in the code that assume this field is always set. This patch uses `has_principal()` before this field is accessed to ensure safety.
> 
> 
> Diffs
> -----
> 
>   src/common/resources.cpp 0fcf86014ab5c9908a1cdb3a57b7c5e70acd7737 
>   src/master/master.cpp 9ee56277c8a472be9e683d5db505becfb5f7c422 
>   src/v1/resources.cpp 126e5a2f567d2e281da3f99bc485f7960567eee5 
> 
> Diff: https://reviews.apache.org/r/42733/diff/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> 
> Thanks,
> 
> Greg Mann
> 
>