Support Questions
Find answers, ask questions, and share your expertise

upgrading from ambari 2.1.2 to 2.2

Explorer

When I run ambari-server upgrade, I get contrainst error:

Batch entry 1 INSERT INTO serviceconfigmapping (config_id, service_config_id) VALUES (3, 290) was aborted. Call getNextException to see the cause.

this table in in the db, has no dups.

thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Explorer

I had to roll back to the previous ambari version fearing that I may have hit a bug with 2.2. I looked at the table you mention, and I found one type that has two rows. hdfs-log4j. Maybe that was the problem. thanks for the Tip. I will try to update again.

View solution in original post

7 REPLIES 7

@Hassan Faouaz oracle or postgres?

@Hassan Faouaz

the ambari-server log (/var/log/ambari-server/ambari-server.log) should have some more details. Can you share that?

Explorer

Thanks Neeraj. Please look at @Ana Gillan answer.

Did you attempt and abort an upgrade already?

Can you please check the clusterconfigmapping table in the Ambari DB and make sure there are no duplicates in the type_name column?

If there are, and then make sure that only 1 of them has a value of "1" in the "selected" column - the one with a later created_timestamp value. Take a backup of the Ambari DB (!!) and then update the "selected" value to 0 for the other one. Then re-attempt the upgrade.

Explorer

I had to roll back to the previous ambari version fearing that I may have hit a bug with 2.2. I looked at the table you mention, and I found one type that has two rows. hdfs-log4j. Maybe that was the problem. thanks for the Tip. I will try to update again.

View solution in original post

Contributor

Even if there are 2 rows in clusterconfigmapping for a config type, you should check if there are more than one entry with selected=1. If you can share the DB dump along with ambari-server log that would help.

Hassan, can you provide the output after running this?

select u.upgrade_id, u.from_version, u.to_version, u.direction, u.upgrade_type, s.stage_id, s.supports_auto_skip_failure, SUBSTR(s.request_context, 0, 40) FROM upgrade u JOIN stage s ON u.request_id = s.request_id ORDER BY s.stage_id ASC;

Also, can you run a describe on the stage table? Here's what my table looks like,

ambari=> \d stage
                           Table "ambari.stage"
           Column           |          Type          |     Modifiers
----------------------------+------------------------+--------------------
 stage_id                   | bigint                 | not null
 request_id                 | bigint                 | not null
 cluster_id                 | bigint                 | not null
 skippable                  | smallint               | not null default 0
 supports_auto_skip_failure | smallint               | not null default 0
 log_info                   | character varying(255) | not null
 request_context            | character varying(255) |
 cluster_host_info          | bytea                  | not null
 command_params             | bytea                  |
 host_params                | bytea                  |
Indexes:
    "stage_pkey" PRIMARY KEY, btree (stage_id, request_id)
Foreign-key constraints:
    "fk_stage_request_id" FOREIGN KEY (request_id) REFERENCES request(request_id)
Referenced by:
    TABLE "host_role_command" CONSTRAINT "fk_host_role_command_stage_id" FOREIGN KEY (stage_id, request_id) REFERENCES stage(stage_id, request_id)
    TABLE "role_success_criteria" CONSTRAINT "role_success_criteria_stage_id" FOREIGN KEY (stage_id, request_id) REFERENCES stage(stage_id, request_id)