Ajit Kumar created AMBARI-17210:
-----------------------------------

             Summary: Deleting host with clients installed, throws 500 server 
error.
                 Key: AMBARI-17210
                 URL: https://issues.apache.org/jira/browse/AMBARI-17210
             Project: Ambari
          Issue Type: Bug
          Components: ambari-server
    Affects Versions: ambari-2.4.0
            Reporter: Ajit Kumar
            Assignee: Ajit Kumar
             Fix For: ambari-2.4.0



Deleting host with clients installed, throws 500 server error. It should return 
well formatted response like 
"message" : "org.apache.ambari.server.controller.spi.SystemException: An 
internal system exception occurred: Cannot remove host c6403.ambari.apache.org 
from c1.  The following roles exist, and these components must be stopped if 
running, and then deleted: HDFS_CLIENT"

{code}
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 
2.6.2.v20151217-774c696): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: update or delete 
on table "hosts" violates foreign key constraint "fk_hcdesiredstate_host_id" on 
table "hostcomponentdesiredstate"
  Detail: Key (host_id)=(1) is still referenced from table 
"hostcomponentdesiredstate".
Error Code: 0
Call: DELETE FROM hosts WHERE (host_id = ?)
        bind => [1 parameter bound]
        at 
org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340)
        at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1620)
        at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:900)
        at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:964)
        at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:633)
        at 
org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatch(ParameterizedSQLBatchWritingMechanism.java:149)
        at 
org.eclipse.persistence.internal.databaseaccess.ParameterizedSQLBatchWritingMechanism.executeBatchedStatements(ParameterizedSQLBatchWritingMechanism.java:134)
        at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.writesCompleted(DatabaseAccessor.java:1845)
        at 
org.eclipse.persistence.internal.sessions.AbstractSession.writesCompleted(AbstractSession.java:4300)
        at 
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.writesCompleted(UnitOfWorkImpl.java:5592)
        at 
org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:456)
        at 
org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:874)
        ... 107 more
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table 
"hosts" violates foreign key constraint "fk_hcdesiredstate_host_id" on table 
"hostcomponentdesiredstate"
  Detail: Key (host_id)=(1) is still referenced from table 
"hostcomponentdesiredstate".
        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
        at 
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:892)
        ... 116 more
{code}



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

Reply via email to