You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@ambari.apache.org by Jonathan Hurley <jh...@hortonworks.com> on 2017/05/15 17:35:50 UTC

Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

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

Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.


Bugs: AMBARI-21022
    https://issues.apache.org/jira/browse/AMBARI-21022


Repository: ambari


Description
-------

The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.

Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.

Using repository associations will also help to track the to/from history for components included in the upgrade.

Some new terminology here:
- "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
- "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
  ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
  ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
  ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
  ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
  ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
  ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
  ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
  ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
  ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
  ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
  ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
  ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
  ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
  ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
  ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
  ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 


Diff: https://reviews.apache.org/r/59277/diff/1/


Testing
-------

I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.


Thanks,

Jonathan Hurley


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Jonathan Hurley <jh...@hortonworks.com>.

> On May 15, 2017, 2:05 p.m., Nate Cole wrote:
> > These changes overall look good; I think we can ditch the tests given all the things changing for this initiative.

Thanks; I'll take care of the nits. I'll see what I can do about tests. There's so much wrong with them now that we've changed this, I don't know whether to try to patch em up or start with new, clean ones. But for this commit in our branch, I'll comment them out to get the branch compiling so work can move forward.


> On May 15, 2017, 2:05 p.m., Nate Cole wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
> > Lines 367-374 (patched)
> > <https://reviews.apache.org/r/59277/diff/1/?file=1718437#file1718437line404>
> >
> >     Do we need any hashCode()/equals() overrides here now that we're using them in a Set?

The logic basically says to only add one per component, but it couldn't hurt. I'll add it.


- Jonathan


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


On May 15, 2017, 1:35 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59277/
> -----------------------------------------------------------
> 
> (Updated May 15, 2017, 1:35 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21022
>     https://issues.apache.org/jira/browse/AMBARI-21022
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.
> 
> Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.
> 
> Using repository associations will also help to track the to/from history for components included in the upgrade.
> 
> Some new terminology here:
> - "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
> - "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
>   ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
>   ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
>   ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
> 
> 
> Diff: https://reviews.apache.org/r/59277/diff/1/
> 
> 
> Testing
> -------
> 
> I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Jonathan Hurley <jh...@hortonworks.com>.

> On May 15, 2017, 2:05 p.m., Nate Cole wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
> > Lines 367-374 (patched)
> > <https://reviews.apache.org/r/59277/diff/1/?file=1718437#file1718437line404>
> >
> >     Do we need any hashCode()/equals() overrides here now that we're using them in a Set?
> 
> Jonathan Hurley wrote:
>     The logic basically says to only add one per component, but it couldn't hurt. I'll add it.

Turns out I added it already :)


- Jonathan


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


On May 15, 2017, 1:35 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59277/
> -----------------------------------------------------------
> 
> (Updated May 15, 2017, 1:35 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21022
>     https://issues.apache.org/jira/browse/AMBARI-21022
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.
> 
> Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.
> 
> Using repository associations will also help to track the to/from history for components included in the upgrade.
> 
> Some new terminology here:
> - "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
> - "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
>   ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
>   ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
>   ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
> 
> 
> Diff: https://reviews.apache.org/r/59277/diff/1/
> 
> 
> Testing
> -------
> 
> I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/59277/#review174992
-----------------------------------------------------------


Ship it!




These changes overall look good; I think we can ditch the tests given all the things changing for this initiative.


ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
Lines 3994 (patched)
<https://reviews.apache.org/r/59277/#comment248299>

    nit: formatting



ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
Lines 3996 (patched)
<https://reviews.apache.org/r/59277/#comment248300>

    nit: formatting



ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
Lines 347 (patched)
<https://reviews.apache.org/r/59277/#comment248303>

    See, I knew you could format it right :)



ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
Lines 367-374 (patched)
<https://reviews.apache.org/r/59277/#comment248302>

    Do we need any hashCode()/equals() overrides here now that we're using them in a Set?


- Nate Cole


On May 15, 2017, 1:35 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59277/
> -----------------------------------------------------------
> 
> (Updated May 15, 2017, 1:35 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21022
>     https://issues.apache.org/jira/browse/AMBARI-21022
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.
> 
> Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.
> 
> Using repository associations will also help to track the to/from history for components included in the upgrade.
> 
> Some new terminology here:
> - "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
> - "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
>   ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
>   ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
>   ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
> 
> 
> Diff: https://reviews.apache.org/r/59277/diff/1/
> 
> 
> Testing
> -------
> 
> I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/59277/#review174991
-----------------------------------------------------------




ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
Line 359 (original), 347 (patched)
<https://reviews.apache.org/r/59277/#comment248295>

    This was a huge change. Essentially build the all-powerful UpgradeContext from either the request map or the existing UpgradeEntity. 
    
    This way, all data of calculating things like target repos are stored in 1 place and we don't need to worry about post-setting methods on this context.



ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
Lines 108-109 (patched)
<https://reviews.apache.org/r/59277/#comment248296>

    This is the "associated" repository. In an upgrade, it's your TO version. In a downgrade, it's your FROM version.



ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
Line 129 (original), 129-135 (patched)
<https://reviews.apache.org/r/59277/#comment248297>

    This keeps track of original vs desired repositories. 
    
    Upgrade
     ZK 2.5.0.0 -> 2.9.9.9
     Storm 2.5.4.2 -> 2.9.9.9
    
    Downgrade
     ZK 2.9.9.9 -> 2.5.0.0
     Storm 2.9.9.9 -> 2.5.4.2



ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java
Lines 264-269 (patched)
<https://reviews.apache.org/r/59277/#comment248298>

    This change happens a lot; there really isn't a single "target" repo anymore since services can be on different repos to start. So, we now do it by service.


- Jonathan Hurley


On May 15, 2017, 1:35 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59277/
> -----------------------------------------------------------
> 
> (Updated May 15, 2017, 1:35 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21022
>     https://issues.apache.org/jira/browse/AMBARI-21022
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.
> 
> Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.
> 
> Using repository associations will also help to track the to/from history for components included in the upgrade.
> 
> Some new terminology here:
> - "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
> - "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
>   ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
>   ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
>   ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
> 
> 
> Diff: https://reviews.apache.org/r/59277/diff/1/
> 
> 
> Testing
> -------
> 
> I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Jonathan Hurley <jh...@hortonworks.com>.

> On May 16, 2017, 5 a.m., Dmitro Lisnichenko wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
> > Lines 576 (patched)
> > <https://reviews.apache.org/r/59277/diff/1/?file=1718429#file1718429line619>
> >
> >     :)
> 
> Dmytro Grinenko wrote:
>     lol, but...well,  better to make it via // ToDo: .....as this name have good chances to leave in the code

Hah, yeah, if I was going to leave it, I'd do a FIXME or an annotation of some sort. I did change this in my most recent patch.


> On May 16, 2017, 5 a.m., Dmitro Lisnichenko wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
> > Lines 344 (patched)
> > <https://reviews.apache.org/r/59277/diff/1/?file=1718433#file1718433line384>
> >
> >     does target version = associated here?

Not always. Let me outline the scenarios: 

ZK on 1.0.0.0
Storm on 1.9.9.9

UPGRADE to 2.0.0.0
- The associated repository is 2.0.0.0
- ZK's source is 1.0.0.0 and target is 2.0.0.0
- Storm's source is 1.9.9.9 and target is 2.0.0.0

DOWNGRADE _from_ 2.0.0.0
- The associated repository is _still_ 2.0.0.0
- ZK's source is 2.0.0.0 and target is 1.0.0.0
- Storm's source is 2.0.0.0 and target is 1.9.9.9

So, target only equals associated in an upgrade.


- Jonathan


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


On May 15, 2017, 1:35 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59277/
> -----------------------------------------------------------
> 
> (Updated May 15, 2017, 1:35 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21022
>     https://issues.apache.org/jira/browse/AMBARI-21022
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.
> 
> Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.
> 
> Using repository associations will also help to track the to/from history for components included in the upgrade.
> 
> Some new terminology here:
> - "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
> - "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
>   ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
>   ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
>   ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
> 
> 
> Diff: https://reviews.apache.org/r/59277/diff/1/
> 
> 
> Testing
> -------
> 
> I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Dmytro Grinenko <ha...@gmail.com>.

> On May 16, 2017, 9 a.m., Dmitro Lisnichenko wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
> > Lines 576 (patched)
> > <https://reviews.apache.org/r/59277/diff/1/?file=1718429#file1718429line619>
> >
> >     :)

lol, but...well,  better to make it via // ToDo: .....as this name have good chances to leave in the code


- Dmytro


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


On May 15, 2017, 5:35 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59277/
> -----------------------------------------------------------
> 
> (Updated May 15, 2017, 5:35 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21022
>     https://issues.apache.org/jira/browse/AMBARI-21022
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.
> 
> Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.
> 
> Using repository associations will also help to track the to/from history for components included in the upgrade.
> 
> Some new terminology here:
> - "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
> - "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
>   ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
>   ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
>   ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
> 
> 
> Diff: https://reviews.apache.org/r/59277/diff/1/
> 
> 
> Testing
> -------
> 
> I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Dmitro Lisnichenko <dl...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/59277/#review175070
-----------------------------------------------------------


Ship it!





ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
Lines 576 (patched)
<https://reviews.apache.org/r/59277/#comment248414>

    :)



ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java
Lines 344 (patched)
<https://reviews.apache.org/r/59277/#comment248415>

    does target version = associated here?


- Dmitro Lisnichenko


On May 15, 2017, 8:35 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59277/
> -----------------------------------------------------------
> 
> (Updated May 15, 2017, 8:35 p.m.)
> 
> 
> Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.
> 
> 
> Bugs: AMBARI-21022
>     https://issues.apache.org/jira/browse/AMBARI-21022
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.
> 
> Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.
> 
> Using repository associations will also help to track the to/from history for components included in the upgrade.
> 
> Some new terminology here:
> - "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
> - "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
>   ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
>   ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
>   ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
>   ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
>   ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
>   ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
>   ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
> 
> 
> Diff: https://reviews.apache.org/r/59277/diff/1/
> 
> 
> Testing
> -------
> 
> I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 59277: Upgrades Should Be Associated With Repositories Instead of String Versions

Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/59277/
-----------------------------------------------------------

(Updated May 16, 2017, 10:39 a.m.)


Review request for Ambari, Dmytro Grinenko, Dmitro Lisnichenko, and Nate Cole.


Changes
-------

Unit tests compiling, but broken for upgrades.


Bugs: AMBARI-21022
    https://issues.apache.org/jira/browse/AMBARI-21022


Repository: ambari


Description
-------

The upgrade entity is modeled currently to store only references to versions For example, to_version is "2.5.0.0-1234" and from_version is "2.3.0.0-1". This presents a problem with support for multiple repositories since two stacks could potentially have the same version, thus preventing a repository from being retrieved simply by its no-longer-unique version.

Instead, the upgrade should be associated with a {{RepositoryVersionEntity}} and enforced in the database.

Using repository associations will also help to track the to/from history for components included in the upgrade.

Some new terminology here:
- "associated_repository" is the repository you're upgrade to (UPGRADE) or downgrading from (DOWNGRADE). It's always singular
- "target_repositories" are the repositories you're trying to get to. In an UPGRADE, these are all the same for all components. In a downgrade, they are the original values of those components before the failed upgrade


Diffs (updated)
-----

  ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapper.java fe6707e568 
  ambari-server/src/main/java/org/apache/ambari/server/agent/ExecutionCommand.java 4ab50eaa03 
  ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java ec5c85ea35 
  ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/AddUpgradeRequestAuditEvent.java 2c6df7b057 
  ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/UpgradeEventCreator.java 456aa00df4 
  ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ef165a5ba5 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java 617d7c0771 
  ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java 882f583a2d 
  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java a762e2b156 
  ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java 7ca6164e75 
  ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 92f1d09ff0 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java 7576e00e54 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHistoryEntity.java 15214684e5 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeEntity.java e5e2de385f 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UpgradeHistoryEntity.java PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AbstractUpgradeServerAction.java de0f282fbb 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckAction.java 4a3bd9b4c7 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/FinalizeUpgradeAction.java 1b9fb23100 
  ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/UpdateDesiredStackAction.java 4500b5d179 
  ambari-server/src/main/java/org/apache/ambari/server/stack/MasterHostResolver.java ce105686f5 
  ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java a68a2e1235 
  ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContextFactory.java 4f15ee2af8 
  ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java 3ec907f1c3 
  ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java c43d3bab7e 
  ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/Direction.java cb4f501544 
  ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/HostOrderGrouping.java d19406edd5 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog220.java a11fd961c6 
  ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql a2a1ea9747 
  ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 6dcbf3de5b 
  ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 15de29cab5 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 9e2f2a7c69 
  ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 473e8ca365 
  ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 72189aaffd 
  ambari-server/src/main/resources/META-INF/persistence.xml 8fd539ae2d 
  ambari-server/src/test/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnableTest.java b361418d90 
  ambari-server/src/test/java/org/apache/ambari/server/audit/request/creator/UpgradeEventCreatorTest.java db76d4e1ee 
  ambari-server/src/test/java/org/apache/ambari/server/checks/PreviousUpgradeCompletedTest.java 4bfa8d435c 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackUpgradeConfigurationMergeTest.java bc178ea57d 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java e2d9cc6129 
  ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java f4ac0b105e 
  ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java 9e47e4da7e 
  ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java 7301c66db7 
  ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java 0ff0b0aec3 
  ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java 325fc90c72 
  ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java e3ffe8fa3d 
  ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java 83a8945ee4 
  ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/StageWrapperBuilderTest.java 0eef63862a 


Diff: https://reviews.apache.org/r/59277/diff/2/

Changes: https://reviews.apache.org/r/59277/diff/1-2/


Testing
-------

I'm considering just commeting out the upgrade test classes for now as there are about 200 compile errors. Most tests need to be re-written anyway. This review is mainly to look over the overall approach to upgrade->repo associations.


Thanks,

Jonathan Hurley