> On April 24, 2015, 2:39 p.m., Nate Cole wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java,
> >  lines 527-529
> > <https://reviews.apache.org/r/33526/diff/1/?file=941078#file941078line527>
> >
> >     desired != current on downgrade; does this matter for upgrade?

Sheesh! Nice catch there. Changing this code to take into account direction:

```
    StackId sourceStackId = null;
    StackId targetStackId = null;

    switch( direction ){
      case UPGRADE:
        sourceStackId = cluster.getCurrentStackVersion();

        RepositoryVersionEntity targetRepositoryVersion = 
s_repoVersionDAO.findMaxByVersion(version);
        targetStackId = targetRepositoryVersion.getStackId();
        break;
      case DOWNGRADE:
        sourceStackId = cluster.getCurrentStackVersion();
        targetStackId = cluster.getDesiredStackVersion();
        break;
    }
```


- Jonathan


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


On April 24, 2015, 2:18 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/33526/
> -----------------------------------------------------------
> 
> (Updated April 24, 2015, 2:18 p.m.)
> 
> 
> Review request for Ambari, Alejandro Fernandez and Nate Cole.
> 
> 
> Bugs: AMBARI-10736
>     https://issues.apache.org/jira/browse/AMBARI-10736
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Downgrade must determine, or be passed, the targeted downgrade stack.  In the 
> event that the downgrade is moving to a version that is different than the 
> current desired (as determined by the Cluster desired stack version), 
> Downgrade must remove those configurations.
> 
> After which, the most current configs for the targeted downgrade version 
> should be re-set as the current for the cluster.
> 
> In addition, the ConfigureAction must be augmented to understand that when it 
> is being invoked by a downgrade, and is across stacks, that it may be 
> no-opping as it reverts
> 
> 
> Diffs
> -----
> 
>   
> ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
>  730fba5 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java 
> 35a1700 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
>  fbaec3e 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
>  8a79d1f 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigMappingEntity.java
>  fa48399 
>   
> ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java
>  1a31252 
>   
> ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
>  49e241f 
>   ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java 
> 855bb3f 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
>  6436e22 
>   
> ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
>  2558de8 
>   
> ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java
>  9c129e8 
> 
> Diff: https://reviews.apache.org/r/33526/diff/
> 
> 
> Testing
> -------
> 
> Manually tested downgrade about 100 zillion times, monitoring the database. 
> 
> Unit tests being written and will update here when they are prepared and 
> pass...
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>

Reply via email to