[Yandex Cloud documentation](../../index.md) > [Yandex MPP Analytics for PostgreSQL](../index.md) > [Step-by-step guides](index.md) > Clusters > Yandex MPP Analytics for PostgreSQL version upgrade

# Yandex MPP Analytics for PostgreSQL version upgrade

You can change the database version of your Yandex MPP Analytics for PostgreSQL cluster.

{% note info %}

Greenplum® upgrades from version 6.28 to 6.29 are supported.

The following upgrades are not supported:

* Manual upgrades between Greenplum® patch versions, e.g., from 6.29.1 to 6.29.2. Such upgrades are performed automatically during maintenance.
* Apache Cloudberry™ version upgrades.
* Migrations between Greenplum® and Apache Cloudberry™.

{% endnote %}

To learn about upgrades within the same version and host maintenance, see [Maintenance](../concepts/maintenance.md).


## Viewing a list of available versions {#versions-list}

{% list tabs group=instructions %}

- Management console {#console}

  In the [management console](https://console.yandex.cloud), open the Yandex MPP Analytics for PostgreSQL cluster [create](cluster-create.md) or [update](update.md) page. You can view the list in the **Version** field.

- REST API {#api}

  1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

      ```bash
      export IAM_TOKEN="<IAM_token>"
      ```

  1. Call the [Versions.List](../api-ref/Versions/list.md) method, e.g., via the following [cURL](https://curl.se/) request:

      ```bash
      curl \
          --request GET \
          --header "Authorization: Bearer $IAM_TOKEN" \
          --url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/versions'
      ```

  1. Check the [server response](../api-ref/Versions/list.md#responses) to make sure your request was successful.

- gRPC API {#grpc-api}

  1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

      ```bash
      export IAM_TOKEN="<IAM_token>"
      ```

  1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
     
     ```bash
     cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
     ```
     
     Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

  1. Call the [VersionsService.List](../api-ref/grpc/Versions/list.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

      ```bash
      grpcurl \
          -format json \
          -import-path ~/cloudapi/ \
          -import-path ~/cloudapi/third_party/googleapis/ \
          -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/versions_service.proto \
          -rpc-header "Authorization: Bearer $IAM_TOKEN" \
          mdb.api.cloud.yandex.net:443 \
          yandex.cloud.mdb.greenplum.v1.VersionsService.List
      ```

  1. Check the [server response](../api-ref/grpc/Versions/list.md#yandex.cloud.mdb.greenplum.v1.ListVersionsResponse) to make sure your request was successful.

{% endlist %}


## Before a version upgrade {#before-update}

Make sure the upgrade will not disrupt your applications:

1. Learn how upgrades may affect your applications:

    * [Greenplum® release notes](https://github.com/open-gpdb/gpdb/releases)
    * [Apache Cloudberry™ release notes](https://cloudberry.apache.org/blog/announce-apache-cloudberry-2.1.0/)

1. Try upgrading a test cluster. You can [deploy it from a backup](cluster-backups.md#restore) of the main cluster, if Yandex MPP Analytics for PostgreSQL [supports](#version-supported) the database version in the backup.
1. [Back up](cluster-backups.md#create-backup) your main cluster before upgrading.


## Upgrading a cluster {#start-update}

{% note alert %}

Once your database version is upgraded, you cannot revert the cluster to the previous version.

{% endnote %}


{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
  1. Navigate to **Yandex MPP Analytics&nbsp;for&nbsp;PostgreSQL**.
  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Select the new version number in the **Version** field.
  1. Click **Save**.

- Terraform {#tf}

  1. Open the current Terraform configuration file with the infrastructure plan.

      For information on how to create this file, see [Creating a cluster Yandex MPP Analytics for PostgreSQL](cluster-create.md).

  1. In the `config` section of the Yandex MPP Analytics for PostgreSQL cluster, add the `version` field (the database version) or update its value if it already exists:

      ```hcl
      resource "yandex_mdb_greenplum_cluster" "<cluster_name>" {
        ...
        version = "<version>"
      }
      ```

  1. Make sure the settings are correct.

      1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
      1. Run this command:
      
         ```bash
         terraform validate
         ```
      
         Terraform will show any errors found in your configuration files.

  1. Confirm updating the resources.

      1. Run this command to view the planned changes:
      
         ```bash
         terraform plan
         ```
      
         If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
      
      1. If everything looks correct, apply the changes:
         1. Run this command:
      
            ```bash
            terraform apply
            ```
      
         1. Confirm updating the resources.
         1. Wait for the operation to complete.

  For more information, see [this Terraform provider guide](../../terraform/resources/mdb_greenplum_cluster.md).

- REST API {#api}

  1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

      ```bash
      export IAM_TOKEN="<IAM_token>"
      ```

  1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

      {% note warning %}
      
      The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
      
      {% endnote %}

      ```bash
      curl \
          --request PATCH \
          --header "Authorization: Bearer $IAM_TOKEN" \
          --header "Content-Type: application/json" \
          -url 'https://mdb.api.cloud.yandex.net/managed-greenplum/v1/clusters/<cluster_ID>' \
          --data '{
                    "updateMask": "config.version",
                    "config": {
                      "version": "<version>"
                    }
                  }'
      ```

      Where:

      * `updateMask`: Comma-separated string of settings to update.

          Here, we only specified a single setting, `config.version`.

      * `config.version`: Target database version.

      You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

  1. View the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

  1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

      ```bash
      export IAM_TOKEN="<IAM_token>"
      ```

  1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
     
     ```bash
     cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
     ```
     
     Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

  1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

      {% note warning %}
      
      The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
      
      {% cut "Format for listing settings" %}
      
      ```yaml
      "update_mask": {
          "paths": [
              "<setting_1>",
              "<setting_2>",
              ...
              "<setting_N>"
          ]
      }
      ```
      
      {% endcut %}
      
      {% endnote %}

      ```bash
      grpcurl \
          -format json \
          -import-path ~/cloudapi/ \
          -import-path ~/cloudapi/third_party/googleapis/ \
          -proto ~/cloudapi/yandex/cloud/mdb/greenplum/v1/cluster_service.proto \
          -rpc-header "Authorization: Bearer $IAM_TOKEN" \
          -d '{
                "cluster_id": "<cluster_ID>",
                "update_mask": {
                  "paths": [
                    "config.version"
                  ]
                },
                "config": {
                  "version": "<version>"
                }
              }' \
          mdb.api.cloud.yandex.net:443 \
          yandex.cloud.mdb.greenplum.v1.ClusterService.Update
      ```

      Where:

      * `update_mask`: List of settings to update as an array of strings (`paths[]`).

          Here, we only specified a single setting, `config.version`.

      * `config.version`: Target database version.

      You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

  1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}