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

(Updated Січ. 5, 2018, 1:20 після полудня)


Review request for Ambari, Andrew Onischuk, Dmytro Grinenko, and Dmytro Sen.


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


Repository: ambari


Description
-------

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}


Diffs (updated)
-----

  
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog252.java
 e6a7829 


Diff: https://reviews.apache.org/r/64951/diff/2/

Changes: https://reviews.apache.org/r/64951/diff/1-2/


Testing
-------

mvn clean test


Thanks,

Vitalyi Brodetskyi

Reply via email to