Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-22724

Idempotent issue on Ambari Upgrade, renameServiceDeletedColumn failed with column already exists exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.6.2
    • 2.6.2
    • ambari-server
    • None

    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:

        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));
          }
        }
      

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

      Table generated DDL from current state:

      -- 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);
      
      
      

      Attachments

        1. AMBARI-22724.patch
          2 kB
          Vitaly Brodetskyi

        Issue Links

          Activity

            People

              vbrodetskyi Vitaly Brodetskyi
              vbrodetskyi Vitaly Brodetskyi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: