Upgrade guide from 1.4.x to 1.5.0

This guide outlines the steps required to generate hash values for natural keys of metadata instances defined in previous versions of Manufacturing Data Engine (MDE). This process is essential for MDE 1.5.0 to correctly assign metadata instances to messages ingested.

  1. Open the Cloud Shell or a terminal where you have gcloud and kubectl available.

  2. Connect to the MDE GKE cluster (replace PROJECT_ID with the project ID where MDE 1.4.x is running).

    gcloud container clusters get-credentials mde-gke --region europe-west1 \
    --project PROJECT_ID
    
  3. Fetch the password for Cloud SQL. You will need it for the following steps.

    kubectl get secret configuration-manager -n mde -o json | jq -r .data.password | base64 --decode ; echo
    
  4. Carefully copy the output password.

  5. Open the Google Cloud console.

  6. Select Cloud SQL.

  7. Click Instances.

  8. Select mde-sql.

    Cloud SQL Instance selection

  9. From the left side menu, click Cloud SQL Studio.

  10. Select metadata-manager from the Database menu.

  11. Select root from the user menu.

  12. Copy the password you fetched previously and click Authenticate.

    Cloud SQL credentials input

  13. Select the metadata_instance_entity*.

  14. Click the three dots on the right side and click Query. This will open a new query editor.

  15. Copy and paste the following SQL code into the query editor and click Run.

    CREATE EXTENSION IF NOT EXISTS pgcrypto;
    
    UPDATE metadata_instance_entity
    SET natural_key_hash = encode(digest(format('%s:%s:%s', bucket_name, bucket_version, natural_key), 'sha1'), 'base64')
    WHERE natural_key_hash IS NULL OR natural_key_hash = '';
    
    UPDATE metadata_instance_entity
    SET valid_from = created_time
    WHERE valid_from IS NULL;
    

    Cloud SQL query

Once the query finishes, you can continue with the rest of the post-upgrade steps.