ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrii Babiichuk (JIRA)" <>
Subject [jira] [Commented] (AMBARI-11216) Refactor service-config 'defaultValue' property into 'savedValue' and 'recommendedValue'
Date Mon, 18 May 2015 14:50:00 GMT


Andrii Babiichuk commented on AMBARI-11216:

> Refactor service-config 'defaultValue' property into 'savedValue' and 'recommendedValue'
> ----------------------------------------------------------------------------------------
>                 Key: AMBARI-11216
>                 URL:
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-web
>    Affects Versions: 2.1.0
>            Reporter: Andrii Babiichuk
>            Assignee: Andrii Babiichuk
>            Priority: Critical
>             Fix For: 2.1.0
>         Attachments: AMBARI-11216.patch
> {{App.ServiceConfigProperty}} class has this property called {{defaultValue}} which is
overloaded and confusing. We want to refactor it into distinct properties called {{savedValue}}
and {{recommendedValue}}.
> *Background*
> Originally this property represented the default value provided by the {{/api/v1/stacks}}
endpoint so that when installing cluster the {{value}} could be accurately populated. Later
to support the _Undo_ action we put the values saved in {{/api/v1/clusters/c1/configurations}}
into the same {{defaultValue}} property. So if {{/api/v1/stacks}} had value '1', and user
saved '2', then {{defaultValue}} would become '2'. If ever {{value}} differed from {{defaultValue}},
then _Undo_ action and other logics would trigger.
> *Problem*
> With the increasing usage of {{/recommendations}} endpoint for config's dynamic values
and value-attributes, the {{defaultValue}} is getting complex to understand and comprehend.
We generally tend to update {{defaultValue}} whenever {{value}} is updated - which is hard
to explain. For example in the add-service wizard we [suppress any updates to core-site.xml|]
because we cannot tell when core-site.xml configs were changed from what is saved on server.
> *Proposal*
> Each config should have 3 values, as they are 3 different entities:
> # {{value}} - Represents the value shown in UI only to the user
> # {{savedValue}} - Represents the value saved in Ambari DB in {{/api/v1/clusters/c1/configurations}}.
Should only be set when loading configs from API.
> # {{recommendedValue}} - Represents the value either provided by {{/api/v1/stacks}} or
by {{/recommendations}}. 
> This will cleanly differentiate the purpose of each variable. This will have an effect
on the logic used like {{#isNotDefaultValue}} and {{#isOverrideChanged}} etc.
> Undo action should be whenever {{value}} != {{savedValue}}.
> Set recommended action should be whenever {{value}} != {{recommendedValue}}
> Add-service wizard should basically save only those config-types which have {{value}}
!= {{savedValue}} etc.
> The change might be as simple as renaming {{defaultValue}} to {{savedValue}}, but the
semantics will be clearer to understand and code.

This message was sent by Atlassian JIRA

View raw message