You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Vitaly Brodetskyi (JIRA)" <ji...@apache.org> on 2018/01/04 16:59:00 UTC

[jira] [Created] (AMBARI-22724) Idempotent issue on Ambari Upgrade, renameServiceDeletedColumn failed with column already exists exception

Vitaly Brodetskyi created AMBARI-22724:
------------------------------------------

             Summary: Idempotent issue on Ambari Upgrade, renameServiceDeletedColumn failed with column already exists exception
                 Key: AMBARI-22724
                 URL: https://issues.apache.org/jira/browse/AMBARI-22724
             Project: Ambari
          Issue Type: Bug
          Components: ambari-server
    Affects Versions: 2.6.2
            Reporter: Vitaly Brodetskyi
            Assignee: Vitaly Brodetskyi
            Priority: Blocker
             Fix For: 2.6.2


Issue discovered alongside with another bugs which leads upgrade to fail in the middle with partially applying changes to DB. It leads to exception in code: 

{code}
  private void renameServiceDeletedColumn() throws AmbariException, SQLException {
    if (dbAccessor.tableHasColumn(CLUSTER_CONFIG_TABLE, SERVICE_DELETED_COLUMN)) {
      dbAccessor.renameColumn(CLUSTER_CONFIG_TABLE, SERVICE_DELETED_COLUMN, new DBAccessor.DBColumnInfo(UNMAPPED_COLUMN, Short.class, null, 0, false));
    }
  }
{code}


Exception:  ERROR: column "unmapped" of relation "clusterconfig" already exists   (err.png)

Table generated DDL from current state: 
{code}
-- auto-generated definition
CREATE TABLE clusterconfig
(
  config_id          INT8(19)           NOT NULL
    CONSTRAINT pk_clusterconfig
    PRIMARY KEY,
  version_tag        VARCHAR(255)       NOT NULL,
  version            INT8(19)           NOT NULL,
  type_name          VARCHAR(255)       NOT NULL,
  cluster_id         INT8(19)           NOT NULL
    CONSTRAINT fk_clusterconfig_cluster_id
    REFERENCES clusters,
  stack_id           INT8(19)           NOT NULL
    CONSTRAINT fk_clusterconfig_stack_id
    REFERENCES stack,
  config_data        TEXT(max)          NOT NULL,
  config_attributes  TEXT(max),
  create_timestamp   INT8(19)           NOT NULL,
  unmapped           INT2(5) DEFAULT 0  NOT NULL,
  selected           INT2(5) DEFAULT 0  NOT NULL,
  selected_timestamp INT8(19) DEFAULT 0 NOT NULL,
  service_deleted    INT2(5) DEFAULT 0  NOT NULL
);

CREATE UNIQUE INDEX uq_config_type_tag
  ON clusterconfig (cluster_id, type_name, version_tag);

CREATE UNIQUE INDEX uq_config_type_version
  ON clusterconfig (cluster_id, type_name, version);


{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)