Re: Review Request 42086: Updated master's Offer validation to handle InverseOffers.

2016-01-08 Thread Joseph Wu


> On Jan. 8, 2016, 4:09 p.m., Klaus Ma wrote:
> > src/master/validation.cpp, line 597
> > 
> >
> > There're several similar code: 
> > if (condition) {
> > return Error();
> > }
> > 
> > Is it possible to introduce a macro, e.g.
> > RETURN_ERROR_IF(condition, "the error message of error");
> > 
> > With that macro, the code will be
> > 
> > InverseOffer* inverseOffer = ...
> > 
> > RETURN_ERROR_IF(inverseOffer == NULL, "Offer " + stringify(offerId) 
> > + " is no longer valid");
> > 
> > offerFrameworkId = inverseOffer->framework_id();

That certainly might be a nice convenience macro, but out of scope for this 
review.  If you'd like to, you can push a review that adds the macro (along 
with some example refactoring) and we can discuss it there.

I'll drop this issue for now.


- Joseph


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


On Jan. 8, 2016, 3:25 p.m., Joseph Wu wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42086/
> ---
> 
> (Updated Jan. 8, 2016, 3:25 p.m.)
> 
> 
> Review request for mesos, Ben Mahler, Artem Harutyunyan, and Joris Van 
> Remoortere.
> 
> 
> Bugs: MESOS-4301
> https://issues.apache.org/jira/browse/MESOS-4301
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Changes `validation::offer::validate` to not error when a valid inverse offer 
> is validated.
> 
> Tweaks `Master::accept` to not print a misleading log line "ACCEPT call used 
> invalid offers ..." when the call only includes inverse offers.
> 
> 
> Diffs
> -
> 
>   src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
>   src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
>   src/master/validation.hpp 380b40279faf180a6f401a5e28280b601dbc648c 
>   src/master/validation.cpp 6a43bce5b7df6a9d939245c4726d060fa19eb305 
> 
> Diff: https://reviews.apache.org/r/42086/diff/
> 
> 
> Testing
> ---
> 
> make check
> 
> # Ran the following and checked for blank output:
> bin/mesos-tests.sh --gtest_filter="*Inverse*Offer*" --verbose 2>&1 /dev/null 
> |  grep "ACCEPT call used invalid offers"
> 
> # Check new test for flakiness:
> bin/mesos-tests.sh --gtest_filter="*OffersAndInverseOffers" 
> --gtest_repeat=1500 --gtest_break_on_failure
> 
> 
> Thanks,
> 
> Joseph Wu
> 
>



Re: Review Request 42086: Updated master's Offer validation to handle InverseOffers.

2016-01-08 Thread Klaus Ma

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



src/master/validation.cpp (line 597)


There're several similar code: 
if (condition) {
return Error();
}

Is it possible to introduce a macro, e.g.
RETURN_ERROR_IF(condition, "the error message of error");

With that macro, the code will be

InverseOffer* inverseOffer = ...

RETURN_ERROR_IF(inverseOffer == NULL, "Offer " + stringify(offerId) + " 
is no longer valid");

offerFrameworkId = inverseOffer->framework_id();


- Klaus Ma


On Jan. 9, 2016, 7:25 a.m., Joseph Wu wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/42086/
> ---
> 
> (Updated Jan. 9, 2016, 7:25 a.m.)
> 
> 
> Review request for mesos, Ben Mahler, Artem Harutyunyan, and Joris Van 
> Remoortere.
> 
> 
> Bugs: MESOS-4301
> https://issues.apache.org/jira/browse/MESOS-4301
> 
> 
> Repository: mesos
> 
> 
> Description
> ---
> 
> Changes `validation::offer::validate` to not error when a valid inverse offer 
> is validated.
> 
> Tweaks `Master::accept` to not print a misleading log line "ACCEPT call used 
> invalid offers ..." when the call only includes inverse offers.
> 
> 
> Diffs
> -
> 
>   src/master/master.hpp f02d165874fa8023675e545793de699aeecae29b 
>   src/master/master.cpp 2d9b7f9540574aa3ef9e5af3b2b8922dffeebac8 
>   src/master/validation.hpp 380b40279faf180a6f401a5e28280b601dbc648c 
>   src/master/validation.cpp 6a43bce5b7df6a9d939245c4726d060fa19eb305 
> 
> Diff: https://reviews.apache.org/r/42086/diff/
> 
> 
> Testing
> ---
> 
> make check
> 
> # Ran the following and checked for blank output:
> bin/mesos-tests.sh --gtest_filter="*Inverse*Offer*" --verbose 2>&1 /dev/null 
> |  grep "ACCEPT call used invalid offers"
> 
> # Check new test for flakiness:
> bin/mesos-tests.sh --gtest_filter="*OffersAndInverseOffers" 
> --gtest_repeat=1500 --gtest_break_on_failure
> 
> 
> Thanks,
> 
> Joseph Wu
> 
>