Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.6.0
    • Component/s: core.api
    • Labels:
      None

      Description

      Migrations don't work on PostgreSQL:

      I followed the documentation for CDH5 (http://www.cloudera.com/content/cloudera-content/cloudera-docs/CM5/latest/Cloudera-Manager-Managing-Clusters/cm5mc_hue_service.html?scroll=cmig_topic_15_unique_1) to switch to PostgreSQL but the South migrations wouldn't work due to:

      FATAL ERROR - The following SQL query failed: ALTER TABLE "desktop_documentpermission" ADD CONSTRAINT "doc_id_refs_id_84b9641c" FOREIGN KEY ("doc_id") REFERENCES "desktop_document" ("id") DEFERRABLE INITIALLY DEFERRED;
      The error was: current transaction is aborted, commands ignored until end of transaction block

      Running migrations for desktop:

      • Migrating forwards to 0007_auto_add_documentpermissionadd_documenttag_add_document.
        > desktop:0001_initial
        > desktop:0002_add_groups_and_homedirs
        > desktop:0003_group_permissions
        > desktop:0004_grouprelations
        > desktop:0005_settings
        > desktop:0006_settings_add_tour
        > desktop:0007_auto_add_documentpermissionadd_documenttag_add_document
        Error in migration: desktop:0007_auto_add_documentpermissionadd_documenttag_add_document

      I was able to "fix" this by inserting

          depends_on = (
            ("oozie", "0025_change_examples_path_format"),
            ("pig", "0001_initial"),
            ("beeswax", "0008_auto__add_field_queryhistory_query_type"),
          )
      

      into `desktop/core/src/desktop/migrations/0007_auto_add_documentpermissionadd_documenttag_add_document.py`.

      More errors from the PostgreSQL logs:

      ERROR: relation "oozie_workflow" does not exist at character 495
      STATEMENT: SELECT "oozie_job"."id", "oozie_job"."owner_id", "oozie_job"."name", "oozie_job"."description", "oozie_job"."last_modified", "oozie_job"."schema_version", "oozie_job"."deployment_dir", "oozie_job"."is_shared", "oozie_job"."parameters", "oozie_job".
      "is_trashed", "oozie_job"."data", "oozie_workflow"."job_ptr_id", "oozie_workflow"."is_single", "oozie_workflow"."start_id", "oozie_workflow"."end_id", "oozie_workflow"."job_xml", "oozie_workflow"."job_properties", "oozie_workflow"."managed" FROM "oozie_workflo
      w" INNER JOIN "oozie_job" ON ("oozie_workflow"."job_ptr_id" = "oozie_job"."id")
      ERROR: current transaction is aborted, commands ignored until end of transaction block
      STATEMENT: SELECT "beeswax_savedquery"."id", "beeswax_savedquery"."type", "beeswax_savedquery"."owner_id", "beeswax_savedquery"."data", "beeswax_savedquery"."name", "beeswax_savedquery"."desc", "beeswax_savedquery"."mtime", "beeswax_savedquery"."is_auto", "be
      eswax_savedquery"."is_trashed" FROM "beeswax_savedquery" ORDER BY "beeswax_savedquery"."mtime" DESC
      ERROR: current transaction is aborted, commands ignored until end of transaction block
      STATEMENT: SELECT "pig_document"."id", "pig_document"."owner_id", "pig_document"."is_design", "pig_pigscript"."document_ptr_id", "pig_pigscript"."data" FROM "pig_pigscript" INNER JOIN "pig_document" ON ("pig_pigscript"."document_ptr_id" = "pig_document"."id")
      ERROR: current transaction is aborted, commands ignored until end of transaction block
      STATEMENT: SELECT "desktop_document"."id", "desktop_document"."owner_id", "desktop_document"."name", "desktop_document"."description", "desktop_document"."last_modified", "desktop_document"."version", "desktop_document"."extra", "desktop_document"."content_type_id", "desktop_document"."object_id" FROM "desktop_document" LEFT OUTER JOIN "desktop_document_tags" ON ("desktop_document"."id" = "desktop_document_tags"."document_id") LEFT OUTER JOIN "desktop_documenttag" ON ("desktop_document_tags"."documenttag_id" = "desktop_documenttag"."id") WHERE "desktop_documenttag"."id" IS NULL
      ERROR: current transaction is aborted, commands ignored until end of transaction block
      STATEMENT: SELECT "desktop_document"."id", "desktop_document"."owner_id", "desktop_document"."name", "desktop_document"."description", "desktop_document"."last_modified", "desktop_document"."version", "desktop_document"."extra", "desktop_document"."content_type_id", "desktop_document"."object_id" FROM "desktop_document" INNER JOIN "desktop_document_tags" ON ("desktop_document"."id" = "desktop_document_tags"."document_id") INNER JOIN "desktop_documenttag" ON ("desktop_document_tags"."documenttag_id" = "desktop_documenttag"."id") WHERE "desktop_documenttag"."tag" = E'example'
      ERROR: current transaction is aborted, commands ignored until end of transaction block
      STATEMENT: SELECT "desktop_document"."id", "desktop_document"."owner_id", "desktop_document"."name", "desktop_document"."description", "desktop_document"."last_modified", "desktop_document"."version", "desktop_document"."extra", "desktop_document"."content_type_id", "desktop_document"."object_id" FROM "desktop_document"
      ERROR: current transaction is aborted, commands ignored until end of transaction block
      STATEMENT: ALTER TABLE "desktop_documentpermission" ADD CONSTRAINT "doc_id_refs_id_84b9641c" FOREIGN KEY ("doc_id") REFERENCES "desktop_document" ("id") DEFERRABLE INITIALLY DEFERRED;

      I just looked at that and picked the latest migrations from Oozie, Pig and Beeswax and added them. I'm sure other dependencies would work as well but this at least makes it work.

        Attachments

          Activity

            People

            • Assignee:
              abe Abraham Elmahrek
              Reporter:
              lars_francke Lars Francke
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: