<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this. in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217213#M66532</link>
    <description>&lt;P&gt;Thanks nshelke it explains everything.&lt;/P&gt;</description>
    <pubDate>Sat, 12 Aug 2017 02:08:44 GMT</pubDate>
    <dc:creator>Rarjun</dc:creator>
    <dc:date>2017-08-12T02:08:44Z</dc:date>
    <item>
      <title>Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217207#M66526</link>
      <description>&lt;P&gt;I checked the Ambari DB and Saw some inconsistencies while upgrading it,&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; select cluster_id,resource_id,upgrade_id,provisioning_state,security_type,desired_stack_id from clusters;
+------------+-------------+------------+--------------------+---------------+------------------+
| cluster_id | resource_id | upgrade_id | provisioning_state | security_type | desired_stack_id |
+------------+-------------+------------+--------------------+---------------+------------------+
|          2 |           4 |       NULL | INSTALLED          | KERBEROS      |                2 |
+------------+-------------+------------+--------------------+---------------+------------------+
1 row in set (0.00 sec)
mysql&amp;gt; update clusters SET upgrade_id = '' where cluster_id = 2;
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`ambari`.`clusters`, CONSTRAINT `FK_clusters_upgrade_id` FOREIGN KEY (`upgrade_id`) REFERENCES `upgrade` (`upgrade_id`))
&lt;/PRE&gt;&lt;P&gt;Getting the Above error while updating the Upgrade_id.&lt;/P&gt;&lt;P&gt;How to update it. Please help.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 22:18:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217207#M66526</guid>
      <dc:creator>Rarjun</dc:creator>
      <dc:date>2017-08-11T22:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217208#M66527</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2384/arjunm5573.html" nodeid="2384"&gt;@arjun more&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Why do you want to set an Empty String to the upgrade_id column?      The upgrade_id  column is mapped with the "upgrade" table's  (upgrade_id).&lt;/P&gt;&lt;P&gt;The NULL value in the clusters table (upgrade_id) field shows that the upgrade is not yet started.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Can you please share the error that made you edit that table?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 22:50:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217208#M66527</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-08-11T22:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217209#M66528</link>
      <description>&lt;P&gt;I want to set this filed to blank value. And I am getting error,&lt;BR /&gt;ERROR 1452(23000):Cannot add or update a child row: a foreign key constraint fails (`ambari`.`clusters`, CONSTRAINT `FK_clusters_upgrade_id` FOREIGN KEY (`upgrade_id`) REFERENCES `upgrade`(`upgrade_id`))&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 23:06:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217209#M66528</guid>
      <dc:creator>Rarjun</dc:creator>
      <dc:date>2017-08-11T23:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217210#M66529</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/2384/arjunm5573.html" nodeid="2384"&gt;@arjun more&lt;/A&gt;&lt;P&gt;You don't need to edit this column. As the error itself says "FOREIGN KEY (`upgrade_id`)" this will be set as &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay SenSharma&lt;/A&gt; suggested.&lt;/P&gt;&lt;P&gt;Please check the Type of column you are trying to edit,&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; desc clusters;
+-----------------------+--------------+------+-----+---------+-------+
| Field                 | Type         | Null | Key | Default | Extra |
+-----------------------+--------------+------+-----+---------+-------+
| cluster_id            | bigint(20)   | NO   | PRI | NULL    |       |
| resource_id           | bigint(20)   | NO   | MUL | NULL    |       |
| upgrade_id            | bigint(20)   | YES  | MUL | NULL    |       |
| cluster_info          | varchar(255) | NO   |     | NULL    |       |
| cluster_name          | varchar(100) | NO   | UNI | NULL    |       |
| provisioning_state    | varchar(255) | NO   |     | INIT    |       |
| security_type         | varchar(32)  | NO   |     | NONE    |       |
| desired_cluster_state | varchar(255) | NO   |     | NULL    |       |
| desired_stack_id      | bigint(20)   | NO   | MUL | NULL    |       |
&lt;/PRE&gt;&lt;P&gt;As the Column is of type bigint(20), it's default value is "NULL".&lt;/P&gt;&lt;P&gt;The blank filed will be show in postgresql DB because of the type of column upgrade_id.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 23:12:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217210#M66529</guid>
      <dc:creator>nshelke</dc:creator>
      <dc:date>2017-08-11T23:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217211#M66530</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2384/arjunm5573.html" nodeid="2384"&gt;@arjun more&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What we wanted to say is ... that  the "NULL" value is how it is shown for MySQL.     &lt;/P&gt;&lt;P&gt;Other databases like PostgreSQL might show that NULL column value as blank.&lt;/P&gt;&lt;P&gt;So as you are using MySQL   so the  NULL value is fine there (until there is a upgrade already going on)   ... Otherwise the value for that column in MYSQL can be seen as NULL.&lt;/P&gt;&lt;P&gt;So your Database shows correct value if there is no upgrade initiated.&lt;/P&gt;&lt;P&gt;NULL is not same as  blank string. So your  update query is Incorrect where you are trying to set a blank string value there.&lt;/P&gt;&lt;P&gt;For Example:&lt;STRONG&gt; in Postgres same value you can see as blank (Empty) but actually that is NULL&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;# psql -U ambari ambari
Password for user ambari: 
psql (9.2.18)
Type "help" for help.

ambari=&amp;gt; SELECT cluster_id , resource_id , upgrade_id , cluster_info , cluster_name, provisioning_state FROM clusters;
 cluster_id | resource_id | upgrade_id | cluster_info | cluster_name | provisioning_state 
------------+-------------+------------+--------------+--------------+--------------------
          2 |           4 |            |              | plain_ambari | INSTALLED

&amp;lt;br&amp;gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;Similar &lt;STRONG&gt;Table on MySQL is shown as following with NULL value:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;mysql&amp;gt; SELECT cluster_id , resource_id , upgrade_id , cluster_info , cluster_name, provisioning_state FROM clusters;
+------------+-------------+------------+--------------+--------------+--------------------+
| cluster_id | resource_id | upgrade_id | cluster_info | cluster_name | provisioning_state |
+------------+-------------+------------+--------------+--------------+--------------------+
|          2 |           4 |       NULL |              | plain        | INSTALLED          |
+------------+-------------+------------+--------------+--------------+--------------------+&lt;/PRE&gt;&lt;P&gt;The Main Question here is  "Why do you want to set the value of that column to blank String" ?       It is already NULL.&lt;BR /&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2384/arjunm5573.html" nodeid="2384"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 23:14:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217211#M66530</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-08-11T23:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217212#M66531</link>
      <description>&lt;P&gt;Thanks for all discriptive answer.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2017 02:08:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217212#M66531</guid>
      <dc:creator>Rarjun</dc:creator>
      <dc:date>2017-08-12T02:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Ambari upgrade_id shows NULL in clusters tables, not able to upgrade ambari because of this.</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217213#M66532</link>
      <description>&lt;P&gt;Thanks nshelke it explains everything.&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2017 02:08:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Ambari-upgrade-id-shows-NULL-in-clusters-tables-not-able-to/m-p/217213#M66532</guid>
      <dc:creator>Rarjun</dc:creator>
      <dc:date>2017-08-12T02:08:44Z</dc:date>
    </item>
  </channel>
</rss>

