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

Removing Tasks From host_role_command Causes Upgrades To Show As PENDING

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.5.0
    • Component/s: ambari-server
    • Labels:
      None

      Description

      It may be necessary to remove entries from the host_role_command table if the size of the table has grown excessively large in order to reduce the query times for "IN_PROGRESS" requests.

      However, if you remove all tasks for an upgrade, but you leave the stages, request, and upgrade items, the upgrade will appear as though it is now PENDING.

      Before Removal
      {
        "href": "http://localhost:8080/api/v1/clusters/c1/upgrades/12",
        "Upgrade": {
          "cluster_name": "c1",
          "create_time": 1480517560897,
          "direction": "UPGRADE",
          "downgrade_allowed": true,
          "end_time": 1480517643350,
          "exclusive": false,
          "from_version": "2.5.0.0-1237",
          "pack": "nonrolling-upgrade-2.5",
          "progress_percent": 0,
          "request_context": "Upgrading to 2.5.2.0-67",
          "request_id": 12,
          "request_status": "COMPLETED",
          "skip_failures": false,
          "skip_service_check_failures": false,
          "start_time": 1480517560950,
          "suspended": false,
          "to_version": "2.5.2.0-67",
          "type": "INTERNAL_REQUEST",
          "upgrade_type": "NON_ROLLING"
        },
        "upgrade_groups": [
        ...
      
      After Removal
      {
        "href": "http://localhost:8080/api/v1/clusters/c1/upgrades/12",
        "Upgrade": {
          "cluster_name": "c1",
          "create_time": 1480517560897,
          "direction": "UPGRADE",
          "downgrade_allowed": true,
          "end_time": 1480517643350,
          "exclusive": false,
          "from_version": "2.5.0.0-1237",
          "pack": "nonrolling-upgrade-2.5",
          "progress_percent": 0,
          "request_context": "Upgrading to 2.5.2.0-67",
          "request_id": 12,
          "request_status": "PENDING",
          "skip_failures": false,
          "skip_service_check_failures": false,
          "start_time": 1480517560950,
          "suspended": false,
          "to_version": "2.5.2.0-67",
          "type": "INTERNAL_REQUEST",
          "upgrade_type": "NON_ROLLING"
        },
        "upgrade_groups": [
        ...
      

      The actual request is showing as COMPLETED correctly:

      {
        "href": "http://localhost:8080/api/v1/clusters/c1/requests/12",
        "Requests": {
          "aborted_task_count": 0,
          "cluster_name": "c1",
          "completed_task_count": 0,
          "create_time": 1480517560897,
          "end_time": 1480517643350,
          "exclusive": false,
          "failed_task_count": 0,
          "id": 12,
          "inputs": null,
          "operation_level": null,
          "progress_percent": 100,
          "queued_task_count": 0,
          "request_context": "Upgrading to 2.5.2.0-67",
          "request_schedule": null,
          "request_status": "COMPLETED",
          "resource_filters": [],
          "start_time": 1480517560950,
          "task_count": 0,
          "timed_out_task_count": 0,
          "type": "INTERNAL_REQUEST"
        },
        "tasks": [],
        ...
      

      STR:

      • Perform a simple upgrade of a ZK-only cluster
      • Find out the ID of the upgrade request (say its 12)
      • Remove tasks
        DELETE FROM execution_command WHERE task_id IN (SELECT task_id FROM host_role_command WHERE request_id = 12)
        
        DELETE FROM host_role_command WHERE request_id = 12
        

        Attachments

        1. AMBARI-19055.patch
          14 kB
          Jonathan Hurley

          Issue Links

            Activity

              People

              • Assignee:
                jonathanhurley Jonathan Hurley
                Reporter:
                jonathanhurley Jonathan Hurley
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: