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

(Updated April 24, 2015, 1:48 a.m.)


Review request for Ambari, Dmitro Lisnichenko, Jonathan Hurley, Sumit Mohanty, 
and Sid Wagle.


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


Repository: ambari


Description
-------

As part of AMBARI-10167 (Delete a host from Ambari cluster is not clean; fails 
to re-add the same host), need to refactor requestoperationlevel and 
kerberos_principal_host tables to use a new host_id column instead of host_name.


Diffs
-----

  
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/Request.java 
ab81dfd 
  
ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
 9bdc4b7 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/KerberosPrincipalHostDAO.java
 64e18bb 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/KerberosPrincipalHostEntity.java
 07c960d 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/KerberosPrincipalHostEntityPK.java
 704476e 
  
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RequestOperationLevelEntity.java
 9f8453c 
  
ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
 5e8b451 
  
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
 f8066ca 
  
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
 6249d2a 
  ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 1a146e0 
  ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql bc6bd32 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql f2a016f 
  ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql 
38a241d 
  ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 30959d0 
  
ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java
 714b6b7 

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


Testing (updated)
-------

Made schema changes on a live cluster, and was able to create requests and 
kerberize the cluster (which inserts records into kerberos_principal_host) 
table.

All unit tests passed on my Mac except 3 unrelated tests that are also failing 
on trunk in my environment.
  
test220Cardinality(org.apache.ambari.server.api.services.KerberosServiceMetaInfoTest):
 Guice provision errors:(..)
  
test220AutoDeploy(org.apache.ambari.server.api.services.KerberosServiceMetaInfoTest):
 Guice provision errors:(..)
  
test220Dependencies(org.apache.ambari.server.api.services.KerberosServiceMetaInfoTest):
 Guice provision errors:(..)

Schema changes needed:
```
ALTER TABLE kerberos_principal_host DROP CONSTRAINT 
kerberos_principal_host_pkey;
ALTER TABLE kerberos_principal_host ADD COLUMN host_id BIGINT NOT NULL;
ALTER TABLE kerberos_principal_host ADD CONSTRAINT kerberos_principal_host_pkey 
PRIMARY KEY (principal_name, host_id);
ALTER TABLE kerberos_principal_host ADD CONSTRAINT FK_krb_pr_host_host_id 
FOREIGN KEY (host_id) REFERENCES hosts (host_id);
ALTER TABLE kerberos_principal_host DROP COLUMN host_name;

ALTER TABLE requestoperationlevel ADD COLUMN host_id BIGINT NOT NULL;
ALTER TABLE requestoperationlevel DROP COLUMN host_name;
```

Sample API to insert a record into requestoperationlevel table,
```
Restart single component on a host, at the host-level
curl -X POST -u admin:admin -H 'X-Requested-By:1' 
http://c6408.ambari.apache.org:8080/api/v1/clusters/c1/requests -d 
'{"RequestInfo":{"command":"RESTART", "context":"Restart ZooKeeper Client on 
c6408.ambari.apache.org", "operation_level":{ "level":"HOST", 
"cluster_name":"c1", "host_name": "c6408.ambari.apache.org"}}, 
"Requests/resource_filters": [{"service_name":"ZOOKEEPER", 
"component_name":"ZOOKEEPER_CLIENT", "hosts":"c6408.ambari.apache.org"}]}'
```


Thanks,

Alejandro Fernandez

Reply via email to