Moodle
  1. Moodle
  2. MDL-33984

2.3 upgrade failing with double unsigned fields in DB

    Details

    • Testing Instructions:
      Hide

      1) TEST: In all the target branches, verify that admin->server->environment shows MySQL 5.1.33 as requirement for Moodle 2.3. Previous Moodle versions show 5.0.25 as req.

      2) TEST: Try to install Moodle 2.3 into older MySQL version. Should not be possible.

      3) TEST: Try to upgrade to Moodle 2.3 into older MySQL version. Should not be possible.

      Show
      1) TEST: In all the target branches, verify that admin->server->environment shows MySQL 5.1.33 as requirement for Moodle 2.3. Previous Moodle versions show 5.0.25 as req. 2) TEST: Try to install Moodle 2.3 into older MySQL version. Should not be possible. 3) TEST: Try to upgrade to Moodle 2.3 into older MySQL version. Should not be possible.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      From the forums (http://moodle.org/mod/forum/discuss.php?d=205378), it looks like if there is a 'double unsigned' field in the DB then it causes the whole upgrade to fail.

      I suppose this is because we don't support unsigned double in the db? In any case maybe it shouldn't cause the whole upgrade to fail:

      error/invalidmysqlnativetype

      More information about this error

      Debug info:
      Error code: invalidmysqlnativetype
      $a contents: double unsigned
      Stack trace:
      line 641 of /lib/dml/mysqli_native_moodle_database.php: dml_exception thrown
      line 534 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->mysqltype2moodletype()
      line 460 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->get_column_info()
      line 522 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_columns()
      line 1551 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
      line 60 of /lib/db/upgradelib.php: call to moodle_database->count_records()
      line 232 of /lib/db/upgrade.php: call to upgrade_mysql_fix_unsigned_columns()
      line 1481 of /lib/upgradelib.php: call to xmldb_main_upgrade()
      line 275 of /admin/index.php: call to upgrade_core()

        Gliffy Diagrams

          Activity

          Hide
          Eloy Lafuente (stronk7) added a comment - - edited

          While I think this can be easily fixed by one of these:

          1) changing the count_records() @ upgradelib to get_field_sql() (to avoid calling metadata stuff). Tricky.
          2) changing the mysqltype2moodletype() method to clean the type with something like:

          $mysql_type = trim(str_replace('UNSIGNED', '', (strtoupper($mysql_type))));
          

          I've asked for more information @ the forums, because it seems that the offending server is returning wrong information in the "data_type" column of the information_schema.columns table. I've tried here creating all sort of doubles/floats, with and without specs and I get constant "double" there, never "double unsigned" (that is the cause of the problem).

          So perhaps it's a MySQL bug... let's see. My vote goes to apply 2) above, no matter or further investigations to detect the offending version of MySQL.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - - edited While I think this can be easily fixed by one of these: 1) changing the count_records() @ upgradelib to get_field_sql() (to avoid calling metadata stuff). Tricky. 2) changing the mysqltype2moodletype() method to clean the type with something like: $mysql_type = trim(str_replace('UNSIGNED', '', (strtoupper($mysql_type)))); I've asked for more information @ the forums, because it seems that the offending server is returning wrong information in the "data_type" column of the information_schema.columns table. I've tried here creating all sort of doubles/floats, with and without specs and I get constant "double" there, never "double unsigned" (that is the cause of the problem). So perhaps it's a MySQL bug... let's see. My vote goes to apply 2) above, no matter or further investigations to detect the offending version of MySQL. Ciao
          Hide
          Eloy Lafuente (stronk7) added a comment - - edited

          Aha, found this:

          http://bugs.mysql.com/bug.php?id=42758

          That seems to be EXACTLY the problem (float columns incorrectly returning "xxx unsigned" in the data_type column. Was fixed in 5.1.33... waiting to get feedback about Doug's mysql version.

          It's in 5.1.33 release notes: http://dev.mysql.com/doc/refman/5.1/en/news-5-1-33.html

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - - edited Aha, found this: http://bugs.mysql.com/bug.php?id=42758 That seems to be EXACTLY the problem (float columns incorrectly returning "xxx unsigned" in the data_type column. Was fixed in 5.1.33... waiting to get feedback about Doug's mysql version. It's in 5.1.33 release notes: http://dev.mysql.com/doc/refman/5.1/en/news-5-1-33.html Ciao
          Hide
          Martin Dougiamas added a comment -

          Since Ubuntu LTS 10.10 (support just ending) has 5.1.63 and Debian has 5.1.63, I think this is fine.

          Bumping to 5.1.33 on release notes.

          Show
          Martin Dougiamas added a comment - Since Ubuntu LTS 10.10 (support just ending) has 5.1.63 and Debian has 5.1.63, I think this is fine. Bumping to 5.1.33 on release notes.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Sending to integration...

          Show
          Eloy Lafuente (stronk7) added a comment - Sending to integration...
          Hide
          Dan Poltawski added a comment -

          Integrated, but not yet tested. Will start that shortly.

          Show
          Dan Poltawski added a comment - Integrated, but not yet tested. Will start that shortly.
          Hide
          Helen Foster added a comment -
          Show
          Helen Foster added a comment - MySQL 5.1.33 requirement added to http://docs.moodle.org/23/en/Upgrading_to_Moodle_2.3#System_requirements
          Hide
          Dan Poltawski added a comment -

          Oh, we have a HORRIBLE message!

          "version 5.1.33 is required and you are running 5.0.51.24.2
          MySQL 4.1.16 is the minimum version required for Moodle 1.6 in order to guarantee that all data can be converted to UTF-8 in the future."

          Show
          Dan Poltawski added a comment - Oh, we have a HORRIBLE message! "version 5.1.33 is required and you are running 5.0.51.24.2 MySQL 4.1.16 is the minimum version required for Moodle 1.6 in order to guarantee that all data can be converted to UTF-8 in the future."
          Hide
          Matteo Scaramuccia added a comment -

          Is it possible to evaluate the proposed alternative, the hack in the Moodle code?
          For those relying in RHEL / CentOS servers:

          Show
          Matteo Scaramuccia added a comment - Is it possible to evaluate the proposed alternative, the hack in the Moodle code? For those relying in RHEL / CentOS servers: 6.x, MySQL v5.1.61 => OK 5.x, MySQL v5.0.95 => KO. Version 5 will be EOLed at 2017/03/31 ( https://access.redhat.com/support/policy/updates/errata/ , http://wiki.centos.org/FAQ/General#head-fe8a0be91ee3e7dea812e8694491e1dde5b75e6d ) and I guess there are several RHEL / CentOS 5 based servers now serving Moodle 2.2-.
          Hide
          Dan Poltawski added a comment -

          Tested environemnt checks on all branches. Upgrade from and install was prevented on older version.

          Though we do have that horrible mysql message - but that is not enough to block this issue.

          Show
          Dan Poltawski added a comment - Tested environemnt checks on all branches. Upgrade from and install was prevented on older version. Though we do have that horrible mysql message - but that is not enough to block this issue.
          Hide
          Dan Poltawski added a comment -

          (I'd like to express my gratitude to snapshot.debian.org for making testing of this issue really easy!)

          Show
          Dan Poltawski added a comment - (I'd like to express my gratitude to snapshot.debian.org for making testing of this issue really easy!)
          Hide
          Martin Dougiamas added a comment -

          Much as I'd like to be able to support every database and browser for ever, we do need to move forward occasionally to save our sanity and focus on functionality and more important bugs.

          We haven't bumped MySQL requirements for 1.5 years, since Moodle 2.0.

          Show
          Martin Dougiamas added a comment - Much as I'd like to be able to support every database and browser for ever, we do need to move forward occasionally to save our sanity and focus on functionality and more important bugs. We haven't bumped MySQL requirements for 1.5 years, since Moodle 2.0.
          Hide
          Matteo Scaramuccia added a comment -

          @Martin: OK, understood.

          Show
          Matteo Scaramuccia added a comment - @Martin: OK, understood.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Added extra commit to the 4 branches to delete the MySQL 4.1.6 explanation, clearly outdated.

          To test, on any version, force the mysql to fail and you will get the standard error message "version xxxxx is required and you are running yyyyy" instea of the 4.1.16 & unicode one.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Added extra commit to the 4 branches to delete the MySQL 4.1.6 explanation, clearly outdated. To test, on any version, force the mysql to fail and you will get the standard error message "version xxxxx is required and you are running yyyyy" instea of the 4.1.16 & unicode one. Ciao
          Hide
          Dan Poltawski added a comment -

          Integrated and tested that change

          Show
          Dan Poltawski added a comment - Integrated and tested that change
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Yay. just in time for Moodle 2.3 release! Many thanks!

          Closing as fixed, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Yay. just in time for Moodle 2.3 release! Many thanks! Closing as fixed, ciao
          Hide
          Matteo Scaramuccia added a comment -

          @Helen: please look at http://docs.moodle.org/23/en/Installing_Moodle#Software, maybe you've already planned it but it misses to mention the new MySQL version. There are other things there to be changed like 2.2 => 2.3 and MOODLE_22_STABLE to MOODLE_23_STABLE. I've not opened a new trivial issue, wondering to have done the right thing .

          Show
          Matteo Scaramuccia added a comment - @Helen: please look at http://docs.moodle.org/23/en/Installing_Moodle#Software , maybe you've already planned it but it misses to mention the new MySQL version. There are other things there to be changed like 2.2 => 2.3 and MOODLE_22_STABLE to MOODLE_23_STABLE. I've not opened a new trivial issue, wondering to have done the right thing .
          Hide
          Dan Poltawski added a comment -

          Hmm, there are further reports of this problem in: http://moodle.org/mod/forum/discuss.php?d=205378

          Show
          Dan Poltawski added a comment - Hmm, there are further reports of this problem in: http://moodle.org/mod/forum/discuss.php?d=205378
          Hide
          Charles Fulton added a comment -

          For those wondering we hit this same bug and Eloy's hack did allow us to complete the upgrade (after disabling the new environment requirement).

          Show
          Charles Fulton added a comment - For those wondering we hit this same bug and Eloy's hack did allow us to complete the upgrade (after disabling the new environment requirement).
          Hide
          Helen Foster added a comment -
          Show
          Helen Foster added a comment - Thanks Matteo, http://docs.moodle.org/23/en/Installing_Moodle updated

            People

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

              Dates

              • Created:
                Updated:
                Resolved: