You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Jonathan Hurley <jh...@hortonworks.com> on 2016/02/09 15:40:30 UTC

Review Request 43360: Add PK to servicecomponentdesiredstate Table To Support FK Relationships

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

Review request for Ambari, Dmitro Lisnichenko and Nate Cole.


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


Repository: ambari


Description
-------

The {{servicecomponentdesiredstate}} table currently uses a compound PK based off of the cluster ID, service name, and component name. There are several problems with this approach:

- Primary Keys should be data that's not part of the business logic of the system and not subject to be changed potentially (as strings are).
- Other tables referencing the {{servicecomponentdesiredstate}} table would now need knowledge of cluster/service/component in order to make the correct FK association. This leads to extra data being tracked as well as data duplication.
- Some databases, such as SQL Server, have problems with the indexing of compound PKs and may lead to deadlocks when querying and updating concurrently.

We should change this table so that it uses a simple PK for referencing. FK relationships as they exist today can still be maintained as long as a {{UNIQUE}} constraint is placed on the table. We should:

- Add a {{UNIQUE}} constraint to the former PK columns
- Add an {{INDEX}} to the former PK columns


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 341d1fd 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b57a467 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java f1af9b0 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java bda2543 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java d56e555 
  ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 7e1dd1d 
  ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java bfb6214 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java b00b0e8 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 91de82a 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java 70b8f9f 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java faf4b96 
  ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql e1e2813 
  ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 46b1983 
  ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql c320720 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql e6e6103 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 56d0947 
  ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 542b815 
  ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 885e422 
  ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ddab65d 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java 6bbcab7 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java 8ff23f8 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java 83018a2 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java 4c48972 

Diff: https://reviews.apache.org/r/43360/diff/


Testing
-------

mvn clean test

Tests run: 3827, Failures: 0, Errors: 0, Skipped: 31

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30:19 min
[INFO] Finished at: 2016-02-08T23:23:05-05:00
[INFO] Final Memory: 50M/727M
[INFO] ------------------------------------------------------------------------


Thanks,

Jonathan Hurley


Re: Review Request 43360: Add PK to servicecomponentdesiredstate Table To Support FK Relationships

Posted by Alejandro Fernandez <af...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43360/#review118425
-----------------------------------------------------------


Ship it!




Ship It!

- Alejandro Fernandez


On Feb. 9, 2016, 2:41 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43360/
> -----------------------------------------------------------
> 
> (Updated Feb. 9, 2016, 2:41 p.m.)
> 
> 
> Review request for Ambari, Dmitro Lisnichenko and Nate Cole.
> 
> 
> Bugs: AMBARI-14972
>     https://issues.apache.org/jira/browse/AMBARI-14972
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The {{servicecomponentdesiredstate}} table currently uses a compound PK based off of the cluster ID, service name, and component name. There are several problems with this approach:
> 
> - Primary Keys should be data that's not part of the business logic of the system and not subject to be changed potentially (as strings are).
> - Other tables referencing the {{servicecomponentdesiredstate}} table would now need knowledge of cluster/service/component in order to make the correct FK association. This leads to extra data being tracked as well as data duplication.
> - Some databases, such as SQL Server, have problems with the indexing of compound PKs and may lead to deadlocks when querying and updating concurrently.
> 
> We should change this table so that it uses a simple PK for referencing. FK relationships as they exist today can still be maintained as long as a {{UNIQUE}} constraint is placed on the table. We should:
> 
> - Add a {{UNIQUE}} constraint to the former PK columns
> - Add an {{INDEX}} to the former PK columns
> 
> This change is to enable new tables, such as the patch history table, to be able to reference a component without duplicating all of the existing information in {{servicecomponentdesiredstate}}
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 341d1fd 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b57a467 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java f1af9b0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java bda2543 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java d56e555 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 7e1dd1d 
>   ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java bfb6214 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java b00b0e8 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 91de82a 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java 70b8f9f 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java faf4b96 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql e1e2813 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 46b1983 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql c320720 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql e6e6103 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 56d0947 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 542b815 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 885e422 
>   ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ddab65d 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java 6bbcab7 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java 8ff23f8 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java 83018a2 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java 4c48972 
> 
> Diff: https://reviews.apache.org/r/43360/diff/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> Tests run: 3827, Failures: 0, Errors: 0, Skipped: 31
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 30:19 min
> [INFO] Finished at: 2016-02-08T23:23:05-05:00
> [INFO] Final Memory: 50M/727M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 43360: Add PK to servicecomponentdesiredstate Table To Support FK Relationships

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


Ship it!




Ship It!

- Dmitro Lisnichenko


On Feb. 9, 2016, 4:41 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43360/
> -----------------------------------------------------------
> 
> (Updated Feb. 9, 2016, 4:41 p.m.)
> 
> 
> Review request for Ambari, Dmitro Lisnichenko and Nate Cole.
> 
> 
> Bugs: AMBARI-14972
>     https://issues.apache.org/jira/browse/AMBARI-14972
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The {{servicecomponentdesiredstate}} table currently uses a compound PK based off of the cluster ID, service name, and component name. There are several problems with this approach:
> 
> - Primary Keys should be data that's not part of the business logic of the system and not subject to be changed potentially (as strings are).
> - Other tables referencing the {{servicecomponentdesiredstate}} table would now need knowledge of cluster/service/component in order to make the correct FK association. This leads to extra data being tracked as well as data duplication.
> - Some databases, such as SQL Server, have problems with the indexing of compound PKs and may lead to deadlocks when querying and updating concurrently.
> 
> We should change this table so that it uses a simple PK for referencing. FK relationships as they exist today can still be maintained as long as a {{UNIQUE}} constraint is placed on the table. We should:
> 
> - Add a {{UNIQUE}} constraint to the former PK columns
> - Add an {{INDEX}} to the former PK columns
> 
> This change is to enable new tables, such as the patch history table, to be able to reference a component without duplicating all of the existing information in {{servicecomponentdesiredstate}}
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 341d1fd 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b57a467 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java f1af9b0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java bda2543 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java d56e555 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 7e1dd1d 
>   ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java bfb6214 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java b00b0e8 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 91de82a 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java 70b8f9f 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java faf4b96 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql e1e2813 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 46b1983 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql c320720 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql e6e6103 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 56d0947 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 542b815 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 885e422 
>   ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ddab65d 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java 6bbcab7 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java 8ff23f8 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java 83018a2 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java 4c48972 
> 
> Diff: https://reviews.apache.org/r/43360/diff/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> Tests run: 3827, Failures: 0, Errors: 0, Skipped: 31
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 30:19 min
> [INFO] Finished at: 2016-02-08T23:23:05-05:00
> [INFO] Final Memory: 50M/727M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 43360: Add PK to servicecomponentdesiredstate Table To Support FK Relationships

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


Ship it!




Ship It!

- Nate Cole


On Feb. 9, 2016, 9:41 a.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43360/
> -----------------------------------------------------------
> 
> (Updated Feb. 9, 2016, 9:41 a.m.)
> 
> 
> Review request for Ambari, Dmitro Lisnichenko and Nate Cole.
> 
> 
> Bugs: AMBARI-14972
>     https://issues.apache.org/jira/browse/AMBARI-14972
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The {{servicecomponentdesiredstate}} table currently uses a compound PK based off of the cluster ID, service name, and component name. There are several problems with this approach:
> 
> - Primary Keys should be data that's not part of the business logic of the system and not subject to be changed potentially (as strings are).
> - Other tables referencing the {{servicecomponentdesiredstate}} table would now need knowledge of cluster/service/component in order to make the correct FK association. This leads to extra data being tracked as well as data duplication.
> - Some databases, such as SQL Server, have problems with the indexing of compound PKs and may lead to deadlocks when querying and updating concurrently.
> 
> We should change this table so that it uses a simple PK for referencing. FK relationships as they exist today can still be maintained as long as a {{UNIQUE}} constraint is placed on the table. We should:
> 
> - Add a {{UNIQUE}} constraint to the former PK columns
> - Add an {{INDEX}} to the former PK columns
> 
> This change is to enable new tables, such as the patch history table, to be able to reference a component without duplicating all of the existing information in {{servicecomponentdesiredstate}}
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 341d1fd 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b57a467 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java f1af9b0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java bda2543 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java d56e555 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 7e1dd1d 
>   ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java bfb6214 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java b00b0e8 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 91de82a 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java 70b8f9f 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java faf4b96 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql e1e2813 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 46b1983 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql c320720 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql e6e6103 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 56d0947 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 542b815 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 885e422 
>   ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ddab65d 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java 6bbcab7 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java 8ff23f8 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java 83018a2 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java 4c48972 
> 
> Diff: https://reviews.apache.org/r/43360/diff/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> Tests run: 3827, Failures: 0, Errors: 0, Skipped: 31
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 30:19 min
> [INFO] Finished at: 2016-02-08T23:23:05-05:00
> [INFO] Final Memory: 50M/727M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 43360: Add PK to servicecomponentdesiredstate Table To Support FK Relationships

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

> On Feb. 9, 2016, 12:52 p.m., Alejandro Fernandez wrote:
> > ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql, line 180
> > <https://reviews.apache.org/r/43360/diff/1/?file=1238448#file1238448line180>
> >
> >     Is there going to be another patch to make the schema changes during Ambari upgrade?

Of course! We have another Jira tracking that now.


- Jonathan


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


On Feb. 9, 2016, 9:41 a.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43360/
> -----------------------------------------------------------
> 
> (Updated Feb. 9, 2016, 9:41 a.m.)
> 
> 
> Review request for Ambari, Dmitro Lisnichenko and Nate Cole.
> 
> 
> Bugs: AMBARI-14972
>     https://issues.apache.org/jira/browse/AMBARI-14972
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The {{servicecomponentdesiredstate}} table currently uses a compound PK based off of the cluster ID, service name, and component name. There are several problems with this approach:
> 
> - Primary Keys should be data that's not part of the business logic of the system and not subject to be changed potentially (as strings are).
> - Other tables referencing the {{servicecomponentdesiredstate}} table would now need knowledge of cluster/service/component in order to make the correct FK association. This leads to extra data being tracked as well as data duplication.
> - Some databases, such as SQL Server, have problems with the indexing of compound PKs and may lead to deadlocks when querying and updating concurrently.
> 
> We should change this table so that it uses a simple PK for referencing. FK relationships as they exist today can still be maintained as long as a {{UNIQUE}} constraint is placed on the table. We should:
> 
> - Add a {{UNIQUE}} constraint to the former PK columns
> - Add an {{INDEX}} to the former PK columns
> 
> This change is to enable new tables, such as the patch history table, to be able to reference a component without duplicating all of the existing information in {{servicecomponentdesiredstate}}
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 341d1fd 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b57a467 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java f1af9b0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java bda2543 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java d56e555 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 7e1dd1d 
>   ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java bfb6214 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java b00b0e8 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 91de82a 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java 70b8f9f 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java faf4b96 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql e1e2813 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 46b1983 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql c320720 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql e6e6103 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 56d0947 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 542b815 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 885e422 
>   ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ddab65d 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java 6bbcab7 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java 8ff23f8 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java 83018a2 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java 4c48972 
> 
> Diff: https://reviews.apache.org/r/43360/diff/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> Tests run: 3827, Failures: 0, Errors: 0, Skipped: 31
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 30:19 min
> [INFO] Finished at: 2016-02-08T23:23:05-05:00
> [INFO] Final Memory: 50M/727M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 43360: Add PK to servicecomponentdesiredstate Table To Support FK Relationships

Posted by Alejandro Fernandez <af...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43360/#review118421
-----------------------------------------------------------




ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql (line 180)
<https://reviews.apache.org/r/43360/#comment179635>

    Is there going to be another patch to make the schema changes during Ambari upgrade?


- Alejandro Fernandez


On Feb. 9, 2016, 2:41 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43360/
> -----------------------------------------------------------
> 
> (Updated Feb. 9, 2016, 2:41 p.m.)
> 
> 
> Review request for Ambari, Dmitro Lisnichenko and Nate Cole.
> 
> 
> Bugs: AMBARI-14972
>     https://issues.apache.org/jira/browse/AMBARI-14972
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> The {{servicecomponentdesiredstate}} table currently uses a compound PK based off of the cluster ID, service name, and component name. There are several problems with this approach:
> 
> - Primary Keys should be data that's not part of the business logic of the system and not subject to be changed potentially (as strings are).
> - Other tables referencing the {{servicecomponentdesiredstate}} table would now need knowledge of cluster/service/component in order to make the correct FK association. This leads to extra data being tracked as well as data duplication.
> - Some databases, such as SQL Server, have problems with the indexing of compound PKs and may lead to deadlocks when querying and updating concurrently.
> 
> We should change this table so that it uses a simple PK for referencing. FK relationships as they exist today can still be maintained as long as a {{UNIQUE}} constraint is placed on the table. We should:
> 
> - Add a {{UNIQUE}} constraint to the former PK columns
> - Add an {{INDEX}} to the former PK columns
> 
> This change is to enable new tables, such as the patch history table, to be able to reference a component without duplicating all of the existing information in {{servicecomponentdesiredstate}}
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 341d1fd 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b57a467 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java f1af9b0 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java bda2543 
>   ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java d56e555 
>   ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 7e1dd1d 
>   ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java bfb6214 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java b00b0e8 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 91de82a 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java 70b8f9f 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java faf4b96 
>   ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql e1e2813 
>   ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 46b1983 
>   ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql c320720 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql e6e6103 
>   ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 56d0947 
>   ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 542b815 
>   ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 885e422 
>   ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ddab65d 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java 6bbcab7 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java 8ff23f8 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java 83018a2 
>   ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java 4c48972 
> 
> Diff: https://reviews.apache.org/r/43360/diff/
> 
> 
> Testing
> -------
> 
> mvn clean test
> 
> Tests run: 3827, Failures: 0, Errors: 0, Skipped: 31
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 30:19 min
> [INFO] Finished at: 2016-02-08T23:23:05-05:00
> [INFO] Final Memory: 50M/727M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 43360: Add PK to servicecomponentdesiredstate Table To Support FK Relationships

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

(Updated Feb. 9, 2016, 9:41 a.m.)


Review request for Ambari, Dmitro Lisnichenko and Nate Cole.


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


Repository: ambari


Description (updated)
-------

The {{servicecomponentdesiredstate}} table currently uses a compound PK based off of the cluster ID, service name, and component name. There are several problems with this approach:

- Primary Keys should be data that's not part of the business logic of the system and not subject to be changed potentially (as strings are).
- Other tables referencing the {{servicecomponentdesiredstate}} table would now need knowledge of cluster/service/component in order to make the correct FK association. This leads to extra data being tracked as well as data duplication.
- Some databases, such as SQL Server, have problems with the indexing of compound PKs and may lead to deadlocks when querying and updating concurrently.

We should change this table so that it uses a simple PK for referencing. FK relationships as they exist today can still be maintained as long as a {{UNIQUE}} constraint is placed on the table. We should:

- Add a {{UNIQUE}} constraint to the former PK columns
- Add an {{INDEX}} to the former PK columns

This change is to enable new tables, such as the patch history table, to be able to reference a component without duplicating all of the existing information in {{servicecomponentdesiredstate}}


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java 341d1fd 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java b57a467 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java f1af9b0 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java bda2543 
  ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java d56e555 
  ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java 7e1dd1d 
  ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java bfb6214 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog150.java b00b0e8 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog170.java 91de82a 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog200.java 70b8f9f 
  ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java faf4b96 
  ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql e1e2813 
  ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 46b1983 
  ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql c320720 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql e6e6103 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 56d0947 
  ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql 542b815 
  ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 885e422 
  ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java ddab65d 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java 6bbcab7 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java 8ff23f8 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java 83018a2 
  ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalogHelper.java 4c48972 

Diff: https://reviews.apache.org/r/43360/diff/


Testing
-------

mvn clean test

Tests run: 3827, Failures: 0, Errors: 0, Skipped: 31

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30:19 min
[INFO] Finished at: 2016-02-08T23:23:05-05:00
[INFO] Final Memory: 50M/727M
[INFO] ------------------------------------------------------------------------


Thanks,

Jonathan Hurley