Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-26371 Review and fix some obvious SELECT DISTINCT + TEXT column
  3. MDL-26317

Errors when upgrading a Windows 1.9.10+ site to to 2.0.1

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Blocker
    • Resolution: Duplicate
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: Installation
    • Labels:
    • Environment:
    • Database:
      Microsoft SQL
    • URL:
      Not available - this is a test server not on the internet.
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      I tried upgrading a copy of my Moodle production website from version 1.9.10+ (Build: 20110112) to 2.0.1 (Build: 20101225) and experienced the following problem. I'm not using a more recent version because of the problems reported in MDL-26025 and I'm not sure if this problem is related to that, but these are the crash details:

      Initially the beginning of the upgrade went fine until I got to a screen saying "Migrated user icons 97/97" (see attached screenshot). The upgrade seemed to "hang" at this point, I left it for about two and a half hours and there was still no progress.

      Since this was a test upgrade I eventually pressed the F5 key to refresh the page and see what happens. The installation seemed to continue and I got several "Success" messages as each of the tables was upgraded.

      Eventually I got a "Error reading from database" message on the enrol_category table. The details show the dreaded "The ntext data type cannot be selected as DISTINCT because it is not comparable" error:

      System
      Updating tags itemtype
      Success

      mod_assignment
      Migrating assignment submissions - 8651/8651.
      0.13 sec

      100% Success

      mod_chat
      Success

      mod_choice
      Success

      mod_data
      Success

      mod_feedback
      Success

      mod_folder
      Success

      mod_forum
      Success

      mod_glossary
      Success

      mod_imscp
      Success

      mod_label
      Success

      mod_lesson
      Migrating lesson files - 2/2.

      100% Success

      mod_page
      Success

      mod_quiz
      Success

      mod_resource
      Success

      mod_scorm
      Success

      mod_survey
      Success

      mod_url
      Success

      mod_wiki
      Adding new fields to wiki table
      Renaming old wiki module tables
      Installing new wiki module tables
      Migrating old wikis to new wikis
      Migrating old entries to new subwikis
      Migrating old pages to new pages
      Migrating old history to new history
      Caching content
      Cleaning wiki table
      Updating comments and tags
      Updating tags itemtype
      Success

      mod_workshop
      Renaming old workshop module tables
      Preparing new workshop module tables
      Copying workshop core data
      Copying submissions

      Copying assessments
      Success

      auth_cas
      Success

      auth_db
      Success

      auth_fc
      Success

      auth_imap
      Success

      auth_ldap
      Success

      auth_mnet
      Success

      auth_nntp
      Success

      auth_pam
      Success

      auth_pop3
      Success

      auth_radius
      Success

      auth_shibboleth
      Success

      enrol_authorize
      Success

      enrol_category
      Error reading from database

      More information about this error
      Debug info: SQLState: 42000<br>
      Error Code: 421<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]The ntext data type cannot be selected as DISTINCT because it is not comparable.<br>
      SQLState: 42000<br>
      Error Code: 421<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]The ntext data type cannot be selected as DISTINCT because it is not comparable.<br>

      SELECT DISTINCT c.*
      FROM mdl_course c
      JOIN mdl_context ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = '50')
      JOIN (SELECT DISTINCT cctx.path
      FROM mdl_course_categories cc
      JOIN mdl_context cctx ON (cctx.instanceid = cc.id AND cctx.contextlevel = '40')
      JOIN mdl_role_assignments ra ON (ra.contextid = cctx.id AND ra.roleid IN ('12','4'))
      ) cat ON (ctx.path LIKE CAST(cat.path AS VARCHAR(255)) + CAST('/%' AS VARCHAR(255)) )
      LEFT JOIN mdl_enrol e ON (e.courseid = c.id AND e.enrol = 'category')
      WHERE e.id IS NULL
      [array (
      0 => 50,
      1 => 40,
      2 => 12,
      3 => 4,
      )]
      Stack trace:
      •line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown
      •line 252 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
      •line 363 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
      •line 761 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query()
      •line 276 of \enrol\category\locallib.php: call to sqlsrv_native_moodle_database->get_recordset_sql()
      •line 72 of \enrol\category\db\install.php: call to enrol_category_sync_full()
      •line 335 of \lib\upgradelib.php: call to xmldb_enrol_category_install()
      •line 1352 of \lib\upgradelib.php: call to upgrade_plugins()
      •line 290 of \admin\index.php: call to upgrade_noncore()

      I clicked the Continue button and I was taken to the Moodle Front Page. The upgrade seems to have completed! I can see the Site News and my Courses. I then login as Adminsitrator and Moodle displays the Plugins Check screen. There are no 'missing' blocks or activities or filters. At the bottom of the page is a Upgrade button. I click on it.

      After a few minutes I get a list of tables that are successfully upgraded, so the upgrade seems to be continuing:

      enrol_cohort
      Success

      enrol_database
      Success

      enrol_flatfile
      Success

      enrol_guest
      Success

      enrol_imsenterprise
      Success

      enrol_ldap
      Success

      enrol_manual
      Success

      enrol_meta
      Success

      enrol_mnet
      Success

      enrol_paypal
      Success

      enrol_self
      Success

      message_email
      Success

      message_jabber
      Success

      message_popup
      Success

      block_blog_menu
      Success

      block_blog_recent
      Success

      block_comments
      Success

      block_community
      Success

      block_completionstatus
      Success

      block_course_overview
      Success

      block_feedback
      Success

      block_html
      Success

      block_mnet_hosts
      Success

      block_myprofile
      Success

      block_navigation
      Success

      block_private_files
      Success

      block_rss_client
      Success

      block_search
      Success

      block_selfcompletion
      Success

      block_settings
      Success

      block_tags
      Success

      filter_emoticon
      Success

      filter_mediaplugin
      Success

      filter_tex
      Success

      filter_urltolink
      Success

      editor_textarea
      Success

      editor_tinymce
      Success

      report_courseoverview
      Success

      report_customlang
      Success

      report_questioninstances
      Success

      report_security
      Success

      report_unittest
      Success

      report_unsuproles
      Success

      coursereport_completion
      Success

      coursereport_log
      Success

      coursereport_outline
      Success

      coursereport_participation
      Success

      coursereport_progress
      Success

      coursereport_stats
      Success

      gradeexport_ods
      Success

      gradeexport_txt
      Success

      gradeexport_xls
      Success

      gradeexport_xml
      Success

      gradeimport_csv
      Success

      gradeimport_xml
      Success

      gradereport_grader
      Success

      gradereport_outcomes
      Success

      gradereport_overview
      Success

      gradereport_user
      Success

      mnetservice_enrol
      Success

      webservice_amf
      Success

      webservice_rest
      Success

      webservice_soap
      Success

      webservice_xmlrpc
      Success

      repository_alfresco
      Success

      repository_boxnet
      Success

      repository_coursefiles
      Success

      repository_dropbox
      Success

      repository_filesystem
      Success

      repository_flickr
      Success

      repository_flickr_public
      Success

      repository_googledocs
      Success

      repository_local
      Success

      repository_merlot
      Success

      repository_picasa
      Success

      repository_recent
      Success

      repository_s3
      Success

      repository_upload
      Success

      repository_url
      Success

      repository_user
      Success

      repository_webdav
      Success

      repository_wikimedia
      Success

      repository_youtube
      Success

      portfolio_boxnet
      Success

      portfolio_download
      Success

      portfolio_flickr
      Success

      portfolio_googledocs
      Success

      portfolio_mahara
      Success

      portfolio_picasa
      Success

      qtype_calculated
      Success

      qtype_essay
      Success

      qtype_match
      Success

      qtype_multianswer
      Success

      qtype_multichoice
      Success

      qtype_numerical
      Success

      qtype_randomsamatch
      Success

      qtype_shortanswer
      Success

      qtype_truefalse
      Success

      assignment_online
      Success

      quiz_overview
      Success

      quiz_statistics
      Success

      workshopform_accumulative
      Success

      workshopform_comments
      Success

      workshopform_numerrors
      Success

      workshopform_rubric
      Success

      workshopeval_best
      Success

      At the bottom of the page is a Continue button. I click on it and I am taken to the "New settings" screens. I leave all the defaults and click the Save Changes button.

      Moodle displays the "The cron.php maintenance script has not been run for at least 24 hours" message. This is nornal since I have disabled the cron job.

      Now the upgrade seems to have completed and I don't see any problems in my courses - but I have over 150 courses and I haven't yet tested each one thoroughly).

      I am concerned about the above SQL errors that I did get and that I had to "restart" the upgrade half-way through. These errors imply that my database was not fully upgraded to the Moodle 2 structure and this could cause problems in the future. (So I'm not willing to upgrade my production instance of Moodle just yet.)

      I'm not sure if the fixes in MDL-26025 will resolve these problems, but I felt the need to report the above!

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: