[ 
https://issues.apache.org/jira/browse/MESOS-1406?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Mahler updated MESOS-1406:
-----------------------------------

          Description: 
All stats.json values should be numeric, but it looks like a regression was 
introduced here:

{noformat}
commit dee9bd96e88053ab96c84253578ed332d343fe41
Author: Charlie Carson <charliecar...@gmail.com>
Date:   Thu Feb 20 16:24:09 2014 -0800

    Add JSON::Boolean to stout/json.hpp.

    If you assign an JSON::Object a bool then it will get coerced into a
    JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True and
    JSON::False do not have constructors from bool.

    The fix is to introduce a common super class, JSON::Boolean, which
    both JSON::True and JSON::False inherit from.  JSON::Boolean has the
    necessary constructor which takes a bool.

    However, this leads to ambiguity when assigning a cstring to
    a JSON::Value, since JSON::String already takes a const char * and
    a const char * is implicitly convertable to a bool.

    The solution for that is to rename the variant from JSON::Value
    to JSON::inner::Variant and to create a new class JSON::Value
    which inherits from JSON::inner::Variant.  The new JSON::Value
    can have all the conversion constructors in a single place, so
    is no ambiguity, and delegate everythign else to the Variant.

    Also added a bunch of unit tests.

    SEE: https://issues.apache.org/jira/browse/MESOS-939

    Review: https://reviews.apache.org/r/17520
{noformat}

This caused all JSON values constructed from booleans to implicitly change from 
0/1 to true/false.

  was:
All stats.json values should be numeric, but it looks like a regression was 
introduced here:

{noformat}
commit f9d1dd819b6cc3843e4d1287ac10276d62cbfed4
Author: Vinod Kone <vi...@twitter.com>
Date:   Tue Nov 19 10:39:27 2013 -0800

    Replaced usage of old detector with new Master contender and detector
    abstractions.

    From: Jiang Yan Xu <y...@jxu.me>
    Review: https://reviews.apache.org/r/15510
{noformat}

Which appears to have been included since 0.16.0.

Old stats.json:

{code}
{
  ...
  "elected": 0,
  ...
}
{code}

{code}
{
  ...
  "elected": false,
  ...
}
{code}

    Affects Version/s:     (was: 0.18.0)
                           (was: 0.17.0)
                           (was: 0.16.0)
        Fix Version/s:     (was: 0.19.0)

> Master stats.json using boolean instead of integral value for 'elected'.
> ------------------------------------------------------------------------
>
>                 Key: MESOS-1406
>                 URL: https://issues.apache.org/jira/browse/MESOS-1406
>             Project: Mesos
>          Issue Type: Bug
>            Reporter: Benjamin Mahler
>            Assignee: Benjamin Mahler
>
> All stats.json values should be numeric, but it looks like a regression was 
> introduced here:
> {noformat}
> commit dee9bd96e88053ab96c84253578ed332d343fe41
> Author: Charlie Carson <charliecar...@gmail.com>
> Date:   Thu Feb 20 16:24:09 2014 -0800
>     Add JSON::Boolean to stout/json.hpp.
>     If you assign an JSON::Object a bool then it will get coerced into a
>     JSON::Number w/ value of 0.0 or 1.0.  This is because JSON::True and
>     JSON::False do not have constructors from bool.
>     The fix is to introduce a common super class, JSON::Boolean, which
>     both JSON::True and JSON::False inherit from.  JSON::Boolean has the
>     necessary constructor which takes a bool.
>     However, this leads to ambiguity when assigning a cstring to
>     a JSON::Value, since JSON::String already takes a const char * and
>     a const char * is implicitly convertable to a bool.
>     The solution for that is to rename the variant from JSON::Value
>     to JSON::inner::Variant and to create a new class JSON::Value
>     which inherits from JSON::inner::Variant.  The new JSON::Value
>     can have all the conversion constructors in a single place, so
>     is no ambiguity, and delegate everythign else to the Variant.
>     Also added a bunch of unit tests.
>     SEE: https://issues.apache.org/jira/browse/MESOS-939
>     Review: https://reviews.apache.org/r/17520
> {noformat}
> This caused all JSON values constructed from booleans to implicitly change 
> from 0/1 to true/false.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to