Alejandro Fernandez created AMBARI-10209:
--------------------------------------------

             Summary: ClusterHostMapping table prevents cluster deployment, 
missing host_id column
                 Key: AMBARI-10209
                 URL: https://issues.apache.org/jira/browse/AMBARI-10209
             Project: Ambari
          Issue Type: Bug
          Components: ambari-server
    Affects Versions: 2.1.0
            Reporter: Alejandro Fernandez
            Assignee: Alejandro Fernandez
            Priority: Critical
             Fix For: 2.1.0


When deploying a new cluster, the embedded Postgres SQL file has incorrect 
columns for the ClusterHostMapping table.

{code}
psql:/Users/jhurley/src/hwx/ambari/ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql:652:
 ERROR:  column "host_id" referenced in foreign key constraint does not exist
{code}

{code:title=During deployment...}
[3/25/15, 1:53:28 PM] Jonathan Hurley: Internal Exception: 
org.postgresql.util.PSQLException: ERROR: column t0.host_id does not exist
[3/25/15, 1:54:00 PM] Jonathan Hurley: Query: ReadAllQuery(name="hostEntities" 
referenceClass=HostEntity sql="SELECT t1.id, t1.cpu_count, t1.cpu_info, 
t1.discovery_status, t1.host_attributes, t1.host_name, t1.ipv4, t1.ipv6, 
t1.last_registration_time, t1.os_arch, t1.os_info, t1.os_type, t1.ph_cpu_count, 
t1.public_host_name, t1.rack_info, t1.total_mem FROM ClusterHostMapping t0, 
hosts t1 WHERE ((t0.cluster_id = ?) AND (t1.id = t0.host_id))")
{code}

It looks like the host_id is commented out of the table. Correcting this causes:
{code}
Caused by: org.postgresql.util.PSQLException: ERROR: null value in column 
"host_name" violates not-null constraint
{code}

It looks like the correct table declaration is:
{code}
CREATE TABLE ambari.ClusterHostMapping (
  cluster_id BIGINT NOT NULL,
  host_id BIGINT NOT NULL,
  PRIMARY KEY (cluster_id, host_id));
GRANT ALL PRIVILEGES ON TABLE ambari.ClusterHostMapping TO :username;
{code}

It looks like all of the SQL files have this problem...




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to