-----------------------------------------------------------
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

Reply via email to