ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [29/50] [abbrv] ambari git commit: Merge branch 'trunk' into branch-feature-AMBARI-12556
Date Thu, 27 Apr 2017 20:20:16 GMT
Merge branch 'trunk' into branch-feature-AMBARI-12556


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/36620ba8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/36620ba8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/36620ba8

Branch: refs/heads/trunk
Commit: 36620ba891066619b980814ab02a8de3e3abe5a3
Parents: 341cb12 f2cb1b6
Author: Nate Cole <ncole@hortonworks.com>
Authored: Fri Feb 17 17:05:46 2017 -0500
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Fri Feb 17 17:05:46 2017 -0500

----------------------------------------------------------------------
 .../stackVersions/StackVersionsListCtrl.js      |  56 +-
 .../ui/admin-web/app/scripts/services/Stack.js  |  15 +-
 .../stackVersions/StackversionsListCtrl_test.js |  38 +-
 .../src/main/python/ambari_agent/security.py    |  17 +-
 .../test/python/ambari_agent/TestSecurity.py    |   2 +
 .../libraries/functions/constants.py            |   2 +
 .../functions/setup_ranger_plugin_xml.py        |  23 +-
 .../libraries/functions/solr_cloud_util.py      | 110 +++-
 .../org/apache/ambari/logsearch/LogSearch.java  |  51 +-
 .../ambari/logsearch/conf/ApiDocConfig.java     |   1 -
 .../ambari/logsearch/conf/SecurityConfig.java   |   1 -
 .../logsearch/conf/SolrAuditLogPropsConfig.java |   1 -
 .../conf/SolrServiceLogPropsConfig.java         |   3 -
 .../apache/ambari/logsearch/util/WebUtil.java   |  65 ++
 .../LogsearchKRBAuthenticationFilter.java       |   7 +-
 ...LogsearchSecurityContextFormationFilter.java |   1 -
 ...rchUsernamePasswordAuthenticationFilter.java |   2 -
 ambari-server/docs/configuration/index.md       |   2 +-
 ambari-server/pom.xml                           |   4 +
 .../actionmanager/ActionDBAccessorImpl.java     | 108 ++--
 .../server/actionmanager/ActionScheduler.java   |  31 +
 .../ambari/server/actionmanager/Request.java    |   8 +-
 .../ambari/server/actionmanager/Stage.java      |  25 +
 .../ambari/server/checks/CheckDescription.java  |   7 +
 .../checks/DatabaseConsistencyCheckHelper.java  | 320 +++++-----
 .../checks/DatabaseConsistencyCheckResult.java  |  50 ++
 .../checks/DatabaseConsistencyChecker.java      |   6 +-
 .../server/checks/RangerSSLConfigCheck.java     |  81 +++
 .../server/configuration/Configuration.java     |   2 +-
 .../AmbariCustomCommandExecutionHelper.java     |   8 +
 .../ambari/server/controller/AmbariServer.java  |  43 +-
 .../internal/AlertTargetResourceProvider.java   |  11 +-
 .../controller/internal/CalculatedStatus.java   | 390 +++++++++++-
 .../ambari/server/events/TaskCreateEvent.java   |  48 ++
 .../apache/ambari/server/events/TaskEvent.java  |  66 ++
 .../ambari/server/events/TaskUpdateEvent.java   |  35 ++
 .../listeners/tasks/TaskStatusListener.java     | 609 +++++++++++++++++++
 .../events/publishers/TaskEventPublisher.java   |  62 ++
 .../server/orm/dao/HostRoleCommandDAO.java      |  67 +-
 .../ambari/server/orm/dao/RequestDAO.java       |   8 +
 .../apache/ambari/server/orm/dao/StageDAO.java  |  32 +-
 .../orm/entities/HostRoleCommandEntity.java     |   4 +-
 .../server/orm/entities/PermissionEntity.java   |  30 +-
 .../server/orm/entities/RequestEntity.java      |  49 +-
 .../ambari/server/orm/entities/StageEntity.java |  70 ++-
 .../server/orm/entities/StageEntityPK.java      |  12 +
 .../authorization/RoleAuthorization.java        |   1 +
 .../internal/InternalAuthenticationToken.java   |  24 +-
 .../ambari/server/state/ConfigHelper.java       |   2 +
 .../server/state/cluster/ClusterImpl.java       |  45 +-
 .../ambari/server/topology/HostRequest.java     |   2 +-
 .../ambari/server/topology/TopologyManager.java |   6 +
 .../server/upgrade/AbstractUpgradeCatalog.java  |   2 +-
 .../server/upgrade/UpgradeCatalog250.java       |  53 ++
 .../server/upgrade/UpgradeCatalog300.java       |  70 +++
 ambari-server/src/main/python/ambari-server.py  |  13 +-
 .../main/python/ambari_server/serverSetup.py    |  11 +-
 .../src/main/python/ambari_server_main.py       |  24 +-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  10 +-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  10 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  10 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  10 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  10 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  10 +-
 .../configuration/infra-solr-security-json.xml  |  82 ++-
 .../0.1.0/package/scripts/params.py             |   9 +-
 .../0.1.0/package/scripts/setup_infra_solr.py   |  17 +-
 .../templates/infra-solr-security.json.j2       |  68 +++
 .../properties/infra-solr-security.json.j2      |  68 ---
 .../0.1.0/package/scripts/ams_service.py        |   4 +
 .../ATLAS/0.1.0.2.3/package/scripts/metadata.py |  20 +
 .../ATLAS/0.1.0.2.3/package/scripts/params.py   |   3 +
 .../ATLAS/0.7.0.2.5/kerberos.json               |   3 +
 .../FLUME/1.4.0.2.0/package/scripts/flume.py    |   4 +-
 .../common-services/HDFS/2.1.0.2.0/widgets.json |  12 +-
 .../common-services/HDFS/3.0.0.3.0/widgets.json |  48 +-
 .../package/scripts/hive_server_interactive.py  |  37 +-
 .../hadoop-metrics2-hivemetastore.properties.j2 |   1 +
 .../hadoop-metrics2-hiveserver2.properties.j2   |   1 +
 .../templates/hadoop-metrics2-llapdaemon.j2     |   1 +
 .../hadoop-metrics2-llaptaskscheduler.j2        |   1 +
 .../LOGSEARCH/0.5.0/kerberos.json               |  39 +-
 .../LOGSEARCH/0.5.0/package/scripts/params.py   |   5 +
 .../0.5.0/package/scripts/setup_logsearch.py    |  22 +-
 .../RANGER/0.4.0/package/scripts/params.py      |  21 +
 .../0.4.0/package/scripts/setup_ranger_xml.py   | 108 +++-
 .../0.5.0/configuration/ranger-admin-site.xml   |  12 +
 .../common-services/RANGER/0.6.0/kerberos.json  |   3 +
 .../0.7.0/configuration/ranger-admin-site.xml   |  31 +
 .../0.5.0.2.3/configuration/kms-env.xml         |  10 +
 .../RANGER_KMS/0.5.0.2.3/package/scripts/kms.py |  51 +-
 .../0.5.0.2.3/package/scripts/params.py         |  10 +
 .../SPARK/1.2.1/package/scripts/setup_livy.py   |   2 +-
 .../SPARK2/2.0.0/package/scripts/setup_livy2.py |   2 +-
 .../YARN/2.1.0.2.0/YARN_widgets.json            |  18 +-
 .../YARN/3.0.0.3.0/YARN_widgets.json            |  18 +-
 .../YARN/3.0.0.3.0/service_advisor.py           |  14 +-
 .../scripts/post-user-creation-hook.sh          |   2 +-
 .../HDP/2.0.6/configuration/cluster-env.xml     |  11 +
 .../HDP/2.0.6/properties/stack_features.json    |  10 +
 .../stacks/HDP/2.2/services/stack_advisor.py    |   1 -
 .../stacks/HDP/2.3/services/HDFS/widgets.json   |  48 +-
 .../HDP/2.3/services/YARN/YARN_widgets.json     |  18 +-
 .../stacks/HDP/2.3/upgrades/config-upgrade.xml  |   7 +
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |   5 +
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |   2 +
 .../stacks/HDP/2.4/upgrades/config-upgrade.xml  |   7 +
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |   5 +
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |   2 +
 .../HIVE/configuration/llap-cli-log4j2.xml      |  22 +-
 .../stacks/HDP/2.5/services/stack_advisor.py    |  13 +-
 .../stacks/HDP/2.5/upgrades/config-upgrade.xml  |   7 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml |   2 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |  16 +-
 .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml     |   2 +
 .../ATLAS/configuration/atlas-log4j.xml         |  17 +-
 .../stacks/HDP/2.6/services/DRUID/kerberos.json |  12 +-
 .../services/HBASE/configuration/hbase-site.xml |  43 ++
 .../configuration/ranger-kms-site.xml           |  68 +++
 .../stacks/HDP/2.6/services/stack_advisor.py    |  20 +-
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   2 +
 .../actionmanager/TestActionDBAccessorImpl.java |   3 +-
 .../actionmanager/TestActionScheduler.java      |  71 ++-
 .../alerts/AmbariPerformanceRunnableTest.java   |   7 +-
 .../DatabaseConsistencyCheckHelperTest.java     | 143 ++++-
 .../server/checks/RangerSSLConfigCheckTest.java | 150 +++++
 .../AmbariManagementControllerTest.java         | 121 ++--
 .../internal/UpgradeResourceProviderTest.java   |   1 -
 .../UpgradeSummaryResourceProviderTest.java     |   1 -
 .../listeners/tasks/TaskStatusListenerTest.java | 164 +++++
 .../security/TestAuthenticationFactory.java     |  44 +-
 .../authorization/AuthorizationHelperTest.java  |  24 +-
 .../ambari/server/state/ConfigHelperTest.java   |   2 +
 .../cluster/ClusterEffectiveVersionTest.java    |   5 +-
 .../server/state/cluster/ClusterTest.java       |  78 ++-
 .../services/RetryUpgradeActionServiceTest.java |   1 -
 .../server/topology/TopologyManagerTest.java    |  35 +-
 .../server/upgrade/UpgradeCatalog242Test.java   |  27 +-
 .../server/upgrade/UpgradeCatalog250Test.java   |  71 ++-
 .../server/upgrade/UpgradeCatalog300Test.java   |   7 +
 .../src/test/python/TestAmbariServer.py         |  32 +-
 .../AMBARI_METRICS/test_metrics_collector.py    |   8 +
 .../python/stacks/2.0.6/FLUME/test_flume.py     |   4 +-
 .../stacks/2.3/ATLAS/test_metadata_server.py    |  10 +
 .../test/python/stacks/2.3/configs/secure.json  |   7 +-
 .../stacks/2.4/AMBARI_INFRA/test_infra_solr.py  |   4 +-
 .../stacks/2.4/LOGSEARCH/test_logsearch.py      |   3 +-
 .../stacks/2.5/RANGER/test_ranger_admin.py      |  27 +-
 .../stacks/2.5/RANGER/test_ranger_usersync.py   |   8 +-
 .../stacks/2.5/RANGER_KMS/test_kms_server.py    |  70 ++-
 .../python/stacks/2.5/SPARK/test_spark_livy.py  |   2 +-
 .../stacks/2.6/RANGER/test_ranger_admin.py      |  49 +-
 .../stacks/2.6/RANGER/test_ranger_tagsync.py    |  19 +-
 .../stacks/2.6/SPARK2/test_spark_livy2.py       |   2 +-
 .../stacks/2.6/common/test_stack_advisor.py     |  69 +++
 .../2.6/configs/ranger-admin-default.json       |   6 +-
 ambari-web/app/assets/test/tests.js             |   1 +
 ambari-web/app/controllers/main.js              |   5 +
 .../controllers/main/service/add_controller.js  |   2 +-
 .../controllers/main/service/info/configs.js    |  37 +-
 .../service/manage_config_groups_controller.js  |  14 +-
 .../app/controllers/wizard/step7_controller.js  |   6 +-
 ambari-web/app/data/dashboard_widgets.js        | 196 ++++++
 .../mappers/alert_definition_summary_mapper.js  |   4 -
 .../app/mappers/alert_definitions_mapper.js     |  15 +-
 ambari-web/app/mappers/alert_groups_mapper.js   |   3 +-
 .../app/mappers/alert_instances_mapper.js       |   2 +-
 .../app/mappers/alert_notification_mapper.js    |   2 +-
 ambari-web/app/mappers/cluster_mapper.js        |   2 +-
 .../app/mappers/components_state_mapper.js      |   6 +-
 .../app/mappers/configs/config_groups_mapper.js |   4 +-
 .../configs/service_config_version_mapper.js    |   3 +-
 ambari-web/app/mappers/configs/themes_mapper.js |  25 +-
 ambari-web/app/mappers/hosts_mapper.js          |  10 +-
 ambari-web/app/mappers/quicklinks_mapper.js     |   3 +-
 .../app/mappers/repository_version_mapper.js    |   9 +-
 ambari-web/app/mappers/root_service_mapper.js   |   5 +-
 ambari-web/app/mappers/server_data_mapper.js    |  40 +-
 ambari-web/app/mappers/service_mapper.js        |   3 +-
 .../app/mappers/service_metrics_mapper.js       |  20 +-
 ambari-web/app/mappers/stack_mapper.js          |   9 +-
 ambari-web/app/mappers/stack_service_mapper.js  |   6 +-
 .../app/mappers/stack_upgrade_history_mapper.js |   3 +-
 ambari-web/app/mappers/stack_version_mapper.js  |   3 +-
 ambari-web/app/mappers/target_cluster_mapper.js |   2 +-
 ambari-web/app/mappers/users_mapper.js          |   2 +-
 ambari-web/app/mappers/widget_mapper.js         |   3 +-
 ambari-web/app/messages.js                      |   2 +-
 .../configs/widgets/unique/num_llap_nodes.js    |   7 +-
 .../app/mixins/common/track_request_mixin.js    |  14 +-
 .../mixins/main/dashboard/widgets/editable.js   |  91 +--
 .../dashboard/widgets/editable_with_limit.js    | 106 +---
 .../widgets/single_numeric_threshold.js         | 127 +---
 .../main/service/configs/config_overridable.js  |   8 +-
 .../app/mixins/main/service/groups_mapping.js   |   1 -
 ambari-web/app/models/user.js                   |   2 +-
 ambari-web/app/routes/main.js                   |   4 +
 ambari-web/app/routes/view.js                   |   7 +
 ambari-web/app/styles/application.less          |   2 +-
 .../common/configs/config_history_flow.hbs      |   6 +-
 .../common/configs/service_config_category.hbs  |   4 +-
 .../main/dashboard/edit_widget_popup.hbs        |  20 +-
 .../edit_widget_popup_single_threshold.hbs      |  12 +-
 ambari-web/app/utils/date/date.js               |  26 +-
 ambari-web/app/utils/http_client.js             |   5 -
 ambari-web/app/views.js                         |   1 +
 .../views/common/configs/config_history_flow.js |  15 +-
 .../app/views/common/configs/controls_view.js   |   2 +-
 .../modal_popups/edit_dashboard_widget_popup.js | 436 +++++++++++++
 .../app/views/main/admin/service_auto_start.js  |   2 +-
 ambari-web/app/views/main/dashboard/widget.js   | 173 ++----
 ambari-web/app/views/main/dashboard/widgets.js  | 266 +-------
 .../main/dashboard/widgets/supervisor_live.js   |   3 +-
 .../views/main/dashboard/widgets/text_widget.js |  23 +-
 .../dashboard/widgets/uptime_text_widget.js     |   9 +-
 .../app/views/main/host/combo_search_box.js     |   1 +
 ambari-web/test/controllers/main/admin_test.js  |   8 +-
 .../test/controllers/main/host/details_test.js  |   4 +-
 .../main/service/add_controller_test.js         |   4 +-
 .../main/service/info/config_test.js            |  71 ++-
 .../test/controllers/main/service/item_test.js  |   2 +-
 .../test/mappers/alert_groups_mapper_test.js    |   4 +-
 ambari-web/test/mappers/service_mapper_test.js  |   2 +-
 .../service/configs/config_overridable_test.js  |  12 +-
 ambari-web/test/models/host_component_test.js   |   2 +-
 .../test/models/host_stack_version_test.js      |  12 +-
 ambari-web/test/models/rack_test.js             |   4 +-
 ambari-web/test/models/stack_service_test.js    |   2 +-
 ambari-web/test/utils/date/date_test.js         |  30 +-
 ambari-web/test/utils/http_client_test.js       |   9 -
 .../edit_dashboard_widget_popup_test.js         | 214 +++++++
 .../stack_upgrade/upgrade_history_view_test.js  |   8 +-
 .../test/views/main/dashboard/widget_test.js    | 112 +---
 .../widgets/hbase_master_uptime_test.js         |   4 +-
 .../dashboard/widgets/namenode_uptime_test.js   |   4 +-
 .../widgets/resource_manager_uptime_test.js     |   4 +-
 .../widgets/uptime_text_widget_test.js          |   4 +-
 .../test/views/main/dashboard/widgets_test.js   |  10 +-
 .../views/main/host/combo_search_box_test.js    |   6 +-
 contrib/views/commons/pom.xml                   |   8 -
 contrib/views/files/pom.xml                     |   8 -
 contrib/views/hive-next/pom.xml                 |  26 -
 .../app/controllers/index/history-query/logs.js |   1 +
 contrib/views/hive20/pom.xml                    |  62 +-
 .../resources/ui/app/components/radio-button.js |   1 -
 .../resources/ui/app/components/upload-table.js |   4 +-
 .../resources/ui/app/locales/en/translations.js |  14 +-
 .../main/resources/ui/app/mixins/ui-logger.js   |  18 +
 .../src/main/resources/ui/app/models/column.js  |   7 +-
 .../databases/database/tables/upload-table.js   |  79 +--
 .../templates/components/csv-format-params.hbs  |  18 +-
 .../templates/databases/database/tables/new.hbs |   2 +-
 .../HiveHistoryMigrationUtility.java            |  26 +-
 ...HiveHistoryQueryMigrationImplementation.java |   2 +-
 .../HiveSavedQueryMigrationImplementation.java  |   4 +-
 .../HiveSavedQueryMigrationUtility.java         |  29 +-
 .../pigjob/PigJobMigrationImplementation.java   |   5 +-
 .../pig/pigjob/PigJobMigrationUtility.java      | 377 ++++++------
 .../PigScriptMigrationImplementation.java       |   5 +-
 .../pigscript/PigScriptMigrationUtility.java    |  27 +-
 .../pigudf/PigUdfMigrationImplementation.java   |   5 +-
 .../pig/pigudf/PigUdfMigrationUtility.java      | 286 ++++-----
 .../scripts/models/MigrationResponse.java       |   6 +
 .../app/models/checkprogress.js                 |   3 +-
 .../app/routes/home-page/hive-history.js        |   7 +-
 .../app/routes/home-page/hive-saved-query.js    |   8 +-
 .../app/routes/home-page/pig-job.js             |   7 +-
 .../app/routes/home-page/pig-script.js          |   8 +-
 .../app/routes/home-page/pig-udf.js             |   8 +-
 .../app/templates/home-page/hive-history.hbs    |   8 +
 .../templates/home-page/hive-saved-query.hbs    |   8 +
 .../app/templates/home-page/pig-job.hbs         |   8 +
 .../app/templates/home-page/pig-script.hbs      |   8 +
 .../app/templates/home-page/pig-udf.hbs         | 187 +++---
 contrib/views/pig/pom.xml                       |   8 -
 contrib/views/pom.xml                           |  11 +
 contrib/views/utils/pom.xml                     |  16 -
 contrib/views/wfmanager/pom.xml                 |   8 -
 .../ui/app/components/bundle-config.js          |   8 +-
 .../resources/ui/app/components/coord-config.js |  37 +-
 .../ui/app/components/decision-add-branch.js    |   5 -
 .../ui/app/components/decision-config.js        |   2 +
 .../ui/app/components/designer-workspace.js     |  17 +-
 .../ui/app/components/flow-designer.js          |  52 +-
 .../resources/ui/app/components/java-action.js  |  21 +-
 .../resources/ui/app/components/job-config.js   |  17 +-
 .../resources/ui/app/components/job-details.js  |  20 +-
 .../main/resources/ui/app/components/job-row.js |  26 +-
 .../ui/app/components/preview-dialog.js         |   4 +
 .../main/resources/ui/app/components/save-wf.js |   2 +-
 .../ui/app/components/search-create-new-bar.js  |  11 +-
 .../resources/ui/app/components/search-table.js |   8 +
 .../resources/ui/app/components/sqoop-action.js |   8 +-
 .../resources/ui/app/components/ssh-action.js   |  29 +-
 .../ui/app/controllers/design/dashboardtab.js   |   8 +-
 .../ui/app/domain/actionjob_hanlder.js          |   4 +-
 .../coordinator/coordinator-xml-generator.js    |  12 +-
 .../coordinator/coordinator-xml-importer.js     |  43 +-
 .../ui/app/domain/cytoscape-flow-renderer.js    |  66 +-
 .../resources/ui/app/domain/cytoscape-style.js  |  30 +-
 .../resources/ui/app/domain/mapping-utils.js    |   2 +-
 .../ui/app/domain/workflow-json-importer.js     |   2 +-
 .../main/resources/ui/app/domain/workflow.js    |  20 +-
 .../src/main/resources/ui/app/routes/design.js  |   6 +-
 .../ui/app/routes/design/dashboardtab.js        |  15 +-
 .../src/main/resources/ui/app/styles/app.less   |  30 +-
 .../templates/components/designer-workspace.hbs |  10 +-
 .../app/templates/components/flow-designer.hbs  |  16 +-
 .../ui/app/templates/components/job-config.hbs  |   4 +-
 .../ui/app/templates/components/job-details.hbs |  46 +-
 .../ui/app/templates/components/job-row.hbs     |  28 +-
 .../app/templates/components/preview-dialog.hbs |   2 +-
 .../ui/app/templates/components/save-wf.hbs     |   6 +-
 .../components/search-create-new-bar.hbs        |   2 +-
 .../app/templates/components/search-table.hbs   |  14 +-
 .../app/templates/components/shell-action.hbs   |  36 +-
 .../app/templates/components/sqoop-action.hbs   |   2 +-
 .../ui/app/templates/components/ssh-action.hbs  |  12 +-
 .../components/workflow-action-editor.hbs       |   2 +-
 .../templates/components/workflow-actions.hbs   |   4 +-
 .../components/workflow-job-details.hbs         |  14 +-
 .../main/resources/ui/app/utils/common-utils.js |   3 +
 .../main/resources/ui/app/utils/constants.js    |   3 +-
 .../app/validators/duplicate-data-node-name.js  |   2 +-
 .../wfmanager/src/main/resources/ui/bower.json  |   3 +-
 .../src/main/resources/ui/ember-cli-build.js    |   1 +
 docs/pom.xml                                    |  34 +-
 327 files changed, 6758 insertions(+), 2924 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
----------------------------------------------------------------------
diff --cc ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
index 3190390,0267a5e..483362b
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog300.java
@@@ -19,12 -19,25 +19,26 @@@ package org.apache.ambari.server.upgrad
  
  
  import java.sql.SQLException;
+ import java.util.ArrayList;
+ import java.util.Collection;
+ import java.util.List;
  import java.util.Map;
  
+ import javax.persistence.EntityManager;
+ 
  import org.apache.ambari.server.AmbariException;
+ import org.apache.ambari.server.actionmanager.HostRoleCommand;
+ import org.apache.ambari.server.actionmanager.HostRoleStatus;
+ import org.apache.ambari.server.actionmanager.Stage;
+ import org.apache.ambari.server.actionmanager.StageFactory;
  import org.apache.ambari.server.controller.AmbariManagementController;
 +import org.apache.ambari.server.orm.DBAccessor.DBColumnInfo;
+ import org.apache.ambari.server.controller.internal.CalculatedStatus;
+ import org.apache.ambari.server.orm.DBAccessor;
  import org.apache.ambari.server.orm.dao.DaoUtils;
+ import org.apache.ambari.server.orm.dao.RequestDAO;
+ import org.apache.ambari.server.orm.entities.RequestEntity;
+ import org.apache.ambari.server.orm.entities.StageEntity;
  import org.apache.ambari.server.state.Cluster;
  import org.apache.ambari.server.state.Clusters;
  import org.apache.ambari.server.state.Config;
@@@ -86,7 -103,16 +106,17 @@@ public class UpgradeCatalog300 extends 
     */
    @Override
    protected void executeDDLUpdates() throws AmbariException, SQLException {
 +    addServiceComponentColumn();
+     updateStageTable();
+   }
+ 
+   protected void updateStageTable() throws SQLException {
+     dbAccessor.addColumn(STAGE_TABLE,
+         new DBAccessor.DBColumnInfo(STAGE_STATUS_COLUMN, String.class, 255, HostRoleStatus.PENDING,
false));
+     dbAccessor.addColumn(STAGE_TABLE,
+         new DBAccessor.DBColumnInfo(STAGE_DISPLAY_STATUS_COLUMN, String.class, 255, HostRoleStatus.PENDING,
false));
+     dbAccessor.addColumn(REQUEST_TABLE,
+         new DBAccessor.DBColumnInfo(REQUEST_DISPLAY_STATUS_COLUMN, String.class, 255, HostRoleStatus.PENDING,
false));
    }
  
    /**
@@@ -126,14 -153,43 +157,53 @@@
  
    }
  
 +  /**
 +   * Updates the {@code servicecomponentdesiredstate} table.
 +   *
 +   * @throws SQLException
 +   */
 +  protected void addServiceComponentColumn() throws SQLException {
 +    dbAccessor.addColumn(UpgradeCatalog250.COMPONENT_TABLE,
 +        new DBColumnInfo("repo_state", String.class, 255, RepositoryVersionState.INIT.name(),
false));
 +
 +  }
+   protected void setStatusOfStagesAndRequests() {
+     executeInTransaction(new Runnable() {
+       @Override
+       public void run() {
+         try {
+           RequestDAO requestDAO = injector.getInstance(RequestDAO.class);
+           StageFactory stageFactory = injector.getInstance(StageFactory.class);
+           EntityManager em = getEntityManagerProvider().get();
+           List<RequestEntity> requestEntities= requestDAO.findAll();
+           for (RequestEntity requestEntity: requestEntities) {
+             Collection<StageEntity> stageEntities= requestEntity.getStages();
+             List <HostRoleStatus> stageDisplayStatuses = new ArrayList<>();
+             List <HostRoleStatus> stageStatuses = new ArrayList<>();
+             for (StageEntity stageEntity: stageEntities) {
+               Stage stage = stageFactory.createExisting(stageEntity);
+               List<HostRoleCommand> hostRoleCommands = stage.getOrderedHostRoleCommands();
+               Map<HostRoleStatus, Integer> statusCount = CalculatedStatus.calculateStatusCountsForTasks(hostRoleCommands);
+               HostRoleStatus stageDisplayStatus = CalculatedStatus.calculateSummaryDisplayStatus(statusCount,
hostRoleCommands.size(), stage.isSkippable());
+               HostRoleStatus stageStatus = CalculatedStatus.calculateStageStatus(hostRoleCommands,
statusCount, stage.getSuccessFactors(), stage.isSkippable());
+               stageEntity.setStatus(stageStatus);
+               stageStatuses.add(stageStatus);
+               stageEntity.setDisplayStatus(stageDisplayStatus);
+               stageDisplayStatuses.add(stageDisplayStatus);
+               em.merge(stageEntity);
+             }
+             HostRoleStatus requestStatus = CalculatedStatus.getOverallStatusForRequest(stageStatuses);
+             requestEntity.setStatus(requestStatus);
+             HostRoleStatus requestDisplayStatus = CalculatedStatus.getOverallDisplayStatusForRequest(stageDisplayStatuses);
+             requestEntity.setDisplayStatus(requestDisplayStatus);
+             em.merge(requestEntity);
+           }
+         } catch (Exception e) {
+           LOG.warn("Setting status for stages and Requests threw exception. ", e);
+         }
+       }
+     });
+ 
+   }
+ 
  }

http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ambari/blob/36620ba8/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
----------------------------------------------------------------------
diff --cc ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
index f5e0bfe,ec001ec..3c933d9
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java
@@@ -40,7 -42,9 +42,8 @@@ public class UpgradeCatalog300Test 
  
      upgradeCatalog300.addNewConfigurationsFromXml();
      upgradeCatalog300.showHcatDeletedUserMessage();
+     upgradeCatalog300.setStatusOfStagesAndRequests();
  
 -
      replay(upgradeCatalog300);
  
      upgradeCatalog300.executeDMLUpdates();
@@@ -50,16 -54,13 +53,20 @@@
  
    @Test
    public void testExecuteDDLUpdates() throws Exception {
 +
+     Method updateStageTable = UpgradeCatalog300.class.getDeclaredMethod("updateStageTable");
 +    Method addServiceComponentColumn = UpgradeCatalog300.class
 +        .getDeclaredMethod("addServiceComponentColumn");
 +
      UpgradeCatalog300 upgradeCatalog300 = createMockBuilder(UpgradeCatalog300.class)
 +        .addMockedMethod(addServiceComponentColumn)
+         .addMockedMethod(updateStageTable)
          .createMock();
  
 +    upgradeCatalog300.addServiceComponentColumn();
 +
+     upgradeCatalog300.updateStageTable();
+ 
      replay(upgradeCatalog300);
  
      upgradeCatalog300.executeDDLUpdates();


Mime
View raw message