You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Olivér Szabó (JIRA)" <ji...@apache.org> on 2018/08/21 13:04:00 UTC
[jira] [Resolved] (AMBARI-24513) NPE when migrating users table
during upgrade to Ambari 2.7.0 with Oracle DB
[ https://issues.apache.org/jira/browse/AMBARI-24513?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Olivér Szabó resolved AMBARI-24513.
-----------------------------------
Resolution: Fixed
> NPE when migrating users table during upgrade to Ambari 2.7.0 with Oracle DB
> ----------------------------------------------------------------------------
>
> Key: AMBARI-24513
> URL: https://issues.apache.org/jira/browse/AMBARI-24513
> Project: Ambari
> Issue Type: Bug
> Components: ambari-server
> Affects Versions: 2.7.0
> Reporter: Sandor Molnar
> Assignee: Sandor Molnar
> Priority: Blocker
> Labels: pull-request-available
> Fix For: 2.7.1
>
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> NPE when migrating users table during upgrade to Ambari 2.7.0 with Oracle DB:
> {noformat}
> 2018-08-20 11:36:46,395 ERROR [main] SchemaUpgradeHelper:207 - Upgrade failed.
> java.lang.NullPointerException
> at org.apache.ambari.server.upgrade.UpgradeCatalog270.convertUserCreationTimeToLong(UpgradeCatalog270.java:595)
> at org.apache.ambari.server.upgrade.UpgradeCatalog270.upgradeUserTables(UpgradeCatalog270.java:342)
> at org.apache.ambari.server.upgrade.UpgradeCatalog270.executeDDLUpdates(UpgradeCatalog270.java:318)
> at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:970)
> at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:205)
> at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:448)
> 2018-08-20 11:36:46,395 ERROR [main] SchemaUpgradeHelper:473 - Exception occurred during upgrade, failed
> org.apache.ambari.server.AmbariException
> at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:208)
> at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.main(SchemaUpgradeHelper.java:448)
> Caused by: java.lang.NullPointerException
> at org.apache.ambari.server.upgrade.UpgradeCatalog270.convertUserCreationTimeToLong(UpgradeCatalog270.java:595)
> at org.apache.ambari.server.upgrade.UpgradeCatalog270.upgradeUserTables(UpgradeCatalog270.java:342)
> at org.apache.ambari.server.upgrade.UpgradeCatalog270.executeDDLUpdates(UpgradeCatalog270.java:318)
> at org.apache.ambari.server.upgrade.AbstractUpgradeCatalog.upgradeSchema(AbstractUpgradeCatalog.java:970)
> at org.apache.ambari.server.upgrade.SchemaUpgradeHelper.executeUpgrade(SchemaUpgradeHelper.java:205)
> ... 1 more
> {noformat}
> *Cause*
> This is caused by one or more records with a {{NULL}} value in the {{create_time}} field.
> For example:
> ||user_id||user_name||user_type||create_time||
> |1|admin|LOCAL|NULL|
> *Workaround*
> Update the relevant records to not have a {{NULL}} in the {{create_time}} column.
> For example:
> {noformat}
> UPDATE users SET create_time=systimestamp WHERE create_time IS NULL;
> {noformat}
> *Solution*
> During upgrade, protect against a {{null}} value for {{currentUserCreateTime.getValue()}} at:
> {code:java|title=org/apache/ambari/server/upgrade/UpgradeCatalog270.java:595}
> dbAccessor.updateTable(USERS_TABLE, temporaryColumnName, currentUserCreateTime.getValue().getTime(),
> "WHERE " + USERS_USER_ID_COLUMN + "=" + currentUserCreateTime.getKey());
> {code}
> If {{currentUserCreateTime.getValue()}} is null, the current timestamp should be used.
> *Note:* This may be a reoccurring issue since there is no provision to ensure that {{create_time}} is not {{NULL}} when initializing the Ambari database:
> {code:java}
> insert into users(user_id, principal_id, user_name, user_password)
> select 1,1,'admin','538916f8943ec225d97a9a86a2c6ec0818c1cd400e09e03b660fdaaec4af29ddbb6f2b1033b81b00' from dual;{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)