> For the complete documentation index, see [llms.txt](https://docs.collibra.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.collibra.com/data-quality-self-hosted/installation/upgrade-data-quality-observability-self-hosted/roll-back-data-quality-observability-self-hosted/roll-back-a-data-quality-observability-self-hosted-deployment-on-amazon-emr.md).

# Roll back a Data Quality & Observability (self-hosted) deployment on Amazon EMR

In an Amazon EMR deployment, `dq-webapp` runs on a persistent EC2 host, `dq-agent` is bootstrapped onto the EMR master node, and `dq-core` runs as a Spark YARN job. Use this procedure to restore the previous version after an unsuccessful upgrade.

The preferred rollback method is an in-place JAR swap on the master node. Cluster deletion is not required and should be avoided.

{% hint style="info" %}
Before you start, confirm you completed the [Roll back Data Quality & Observability (self-hosted)](/data-quality-self-hosted/installation/upgrade-data-quality-observability-self-hosted/roll-back-data-quality-observability-self-hosted.md#pre-upgrade-checklist) before upgrading.
{% endhint %}

## Prerequisites

* SSH access to the EMR master node.
* The previous version JARs available in the S3 package location.
* The Metastore snapshot from before the upgrade (required if schema migrations ran).

## In-place rollback (preferred)

{% stepper %}
{% step %}
SSH to the EMR master node.

```
ssh hadoop@<master-node-dns>
```

{% endstep %}

{% step %}
Stop the agent.

```
$OWL_BASE/owl/bin/owlmanage.sh stop=owlagent
```

{% endstep %}

{% step %}
Restore the previous JARs from S3.

```
cd $OWL_BASE/owl/bin
 
mv dq-agent-<new-version>.jar                      dq-agent-<new-version>.jar.bad
mv dq-core-<new-version>-with-dependencies.jar     dq-core-<new-version>-with-dependencies.jar.bad
 
aws s3 cp s3://<OWL_PACKAGE_LOCATION>/dq-agent-<old-version>.jar .
aws s3 cp s3://<OWL_PACKAGE_LOCATION>/dq-core-<old-version>-with-dependencies.jar .
```

{% endstep %}

{% step %}
Restore the Metastore if schema migrations ran during the upgrade.

{% hint style="info" %}
Skip this step if the upgrade was a patch release with no schema migrations.
{% endhint %}

```
pg_restore -h <RDS_HOST> -U <RDS_USER> -d owldb owldb_backup_<timestamp>.dump
```

{% endstep %}

{% step %}
Restart the agent.

```
$OWL_BASE/owl/bin/owlmanage.sh start=owlagent
```

{% endstep %}

{% step %}
Roll back `dq-webapp` on the persistent EC2 host if it was upgraded separately.

Follow [Roll back a Spark standalone Data Quality & Observability (self-hosted) deployment](/data-quality-self-hosted/installation/upgrade-data-quality-observability-self-hosted/roll-back-data-quality-observability-self-hosted/roll-back-a-spark-standalone-data-quality-observability-self-hosted-deployment.md#steps) for the webapp host.
{% endstep %}

{% step %}
Verify the rollback was successful.

```
tail -f $OWL_BASE/owl/log/owl-agent.log
 
psql -h <RDS_HOST> -U <RDS_USER> -d owldb \
  -c "SELECT agent_name, status, updt_ts FROM agent ORDER BY updt_ts DESC LIMIT 5;"
```

Confirm all items in the [Roll back a Data Quality & Observability (self-hosted) deployment on Amazon EMR](#verification-checklist).
{% endstep %}
{% endstepper %}

## Cluster recreation (fallback only)

Use this path only if the master node is lost, replaced, or the cluster must be rebuilt. Update the bootstrap action `Args` to reference the old version before creating the new cluster.

{% stepper %}
{% step %}
Update the bootstrap action configuration to reference the previous version.

```
{
  "Name": "Install DQ Agent",
  "ScriptBootstrapAction": {
    "Path": "s3://<OWL_PACKAGE_LOCATION>/install-agent-emr.sh",
    "Args": [
      "<old-version>",
      "<OWL_AGENT_ID>",
      "<RDS_HOST>",
      "<RDS_USER>",
      "<RDS_PASS>",
      "<OWL_PACKAGE_LOCATION>",
      "<LICENSE_KEY>",
      "<NATIVE_SPARK_SUBMIT>"
    ]
  }
}
```

{% endstep %}

{% step %}
Stop the existing cluster.

```
aws emr terminate-clusters --cluster-ids <cluster-id>
```

{% endstep %}

{% step %}
Create a new cluster using the updated bootstrap configuration.

```
aws emr create-cluster \
  --name "DQ-Agent-Cluster" \
  --release-label emr-<version> \
  --applications Name=Spark \
  --bootstrap-actions file://bootstrap-old-version.json \
  ...
```

{% endstep %}
{% endstepper %}

## Rollback verification checklist

After the rollback, confirm the following before declaring success:

* `dq-webapp` health endpoint returns HTTP 200.
* `dq-webapp` logs show no Flyway version mismatch errors.
* `dq-agent` log shows a successful connection to the Metastore.
* The agent appears as `ACTIVE` in the `agent` table in the Metastore.
* A test job submits successfully and reaches `FINISHED` status in `agent_q`.
* The scheduler picks up and runs a scheduled job (check the `job_schedule_attempt` table).
* The UI loads and displays historical findings correctly.
