Moodle
  1. Moodle
  2. MDL-37016

null event.uuid's discovered when upgrading to Moodle 2.4

    Details

    • Story Points:
      8
    • Rank:
      54812
    • Sprint:
      BACKEND Sprint 7

      Description

      When I tried to upgrade to Moodle 2.4 from Moodle 2.3.3+, I received the following message:

      System
      
      DDL sql execution error
      
      More information about this error
      
      Debug info: Data truncated for column 'uuid' at row 11
      ALTER TABLE mdl_event MODIFY COLUMN uuid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' after visible
      Error code: ddlexecuteerror
      Stack trace:
      line 432 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
      line 860 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 88 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->change_database_structure()
      line 77 of /lib/ddl/database_manager.php: call to database_manager->execute_sql()
      line 586 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr()
      line 598 of /lib/ddl/database_manager.php: call to database_manager->change_field_type()
      line 1308 of /lib/db/upgrade.php: call to database_manager->change_field_precision()
      line 1493 of /lib/upgradelib.php: call to xmldb_main_upgrade()
      line 284 of /admin/index.php: call to upgrade_core()
      

        Activity

        Hide
        Michael J. Frith added a comment -

        I went into the mySQL data and removed all the NULL characters from uuid column in the mdl_event table by hand. After that, moodle upgraded to 2.4 with no further issues.

        I was upgrading from Moodle 2.3.3+.

        Mike

        Show
        Michael J. Frith added a comment - I went into the mySQL data and removed all the NULL characters from uuid column in the mdl_event table by hand. After that, moodle upgraded to 2.4 with no further issues. I was upgrading from Moodle 2.3.3+. Mike
        Hide
        Dan Poltawski added a comment -

        Hmm, Michael - how old is this Moodle install?

        Looking at the history I see that the uuid field has been NOT NULL since its inception:

        https://github.com/moodle/moodle/commit/98f8f9c2182e6319f540bfbb8566b2132f3c0713

        Show
        Dan Poltawski added a comment - Hmm, Michael - how old is this Moodle install? Looking at the history I see that the uuid field has been NOT NULL since its inception: https://github.com/moodle/moodle/commit/98f8f9c2182e6319f540bfbb8566b2132f3c0713
        Hide
        Dan Poltawski added a comment -

        Have you ever installed a modification for calendar, or done anything custom with this data?

        Show
        Dan Poltawski added a comment - Have you ever installed a modification for calendar, or done anything custom with this data?
        Hide
        Michael J. Frith added a comment -

        Hi Dan,

        I do not remember doing anything special to the calendar. The database has been in use for the past 6 years.

        Mike

        Show
        Michael J. Frith added a comment - Hi Dan, I do not remember doing anything special to the calendar. The database has been in use for the past 6 years. Mike
        Hide
        Geoff Waring added a comment -

        I have the same issue. Upgrading from 2.3.3 to 2.4.
        System

        DDL sql execution error

        More information about this error
        Debug info: Data truncated for column 'uuid' at row 9
        ALTER TABLE mdl_event MODIFY COLUMN uuid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' after visible
        Error code: ddlexecuteerror
        Stack trace:

        line 432 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
        line 860 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
        line 88 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->change_database_structure()
        line 77 of /lib/ddl/database_manager.php: call to database_manager->execute_sql()
        line 586 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr()
        line 598 of /lib/ddl/database_manager.php: call to database_manager->change_field_type()
        line 1308 of /lib/db/upgrade.php: call to database_manager->change_field_precision()
        line 1493 of /lib/upgradelib.php: call to xmldb_main_upgrade()
        line 284 of /admin/index.php: call to upgrade_core()

        Show
        Geoff Waring added a comment - I have the same issue. Upgrading from 2.3.3 to 2.4. System DDL sql execution error More information about this error Debug info: Data truncated for column 'uuid' at row 9 ALTER TABLE mdl_event MODIFY COLUMN uuid VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' after visible Error code: ddlexecuteerror Stack trace: line 432 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown line 860 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 88 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->change_database_structure() line 77 of /lib/ddl/database_manager.php: call to database_manager->execute_sql() line 586 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr() line 598 of /lib/ddl/database_manager.php: call to database_manager->change_field_type() line 1308 of /lib/db/upgrade.php: call to database_manager->change_field_precision() line 1493 of /lib/upgradelib.php: call to xmldb_main_upgrade() line 284 of /admin/index.php: call to upgrade_core()
        Hide
        Geoff Waring added a comment -

        I did as suggested by Michael earlier and removed using phpmyadmin a single "NULL" I found on one row of my mdl_event table. Then the upgrade ran successfully.

        Show
        Geoff Waring added a comment - I did as suggested by Michael earlier and removed using phpmyadmin a single "NULL" I found on one row of my mdl_event table. Then the upgrade ran successfully.
        Hide
        Michael de Raadt added a comment -

        Yes, it would be good to know where these null values are coming from.

        Geoff and Michael, did you note any of the other fields in the rows with null UUID values?

        Show
        Michael de Raadt added a comment - Yes, it would be good to know where these null values are coming from. Geoff and Michael, did you note any of the other fields in the rows with null UUID values?
        Hide
        Kris Stokking added a comment -

        We have a very small percentage of sites affected (27), although the number of records in some of them is quite high (~20k in the largest site). I checked out the MIN and MAX timemodified's - some sites are clearly from a very old version of Moodle, but most are from within the last 2 years. Almost all of them have a timemodified from within this week, which indicates the problem persists, possibly through backup/restore.

        Instead of removing records, would it be safe to set them to '', as the default in the alter table suggests?

        Show
        Kris Stokking added a comment - We have a very small percentage of sites affected (27), although the number of records in some of them is quite high (~20k in the largest site). I checked out the MIN and MAX timemodified's - some sites are clearly from a very old version of Moodle, but most are from within the last 2 years. Almost all of them have a timemodified from within this week, which indicates the problem persists, possibly through backup/restore. Instead of removing records, would it be safe to set them to '', as the default in the alter table suggests?
        Hide
        Michael de Raadt added a comment -

        Thanks for the additional information.

        Show
        Michael de Raadt added a comment - Thanks for the additional information.
        Hide
        Petr Škoda added a comment -

        Thanks for the report.

        Show
        Petr Škoda added a comment - Thanks for the report.
        Hide
        Sam Hemelryk added a comment -

        Looks spot on thanks Petr - shifting to the integration queue

        Show
        Sam Hemelryk added a comment - Looks spot on thanks Petr - shifting to the integration queue
        Hide
        Dan Poltawski added a comment -

        Integrated to master, 26, 25 and 24, thanks

        Show
        Dan Poltawski added a comment - Integrated to master, 26, 25 and 24, thanks
        Hide
        Ankit Agarwal added a comment -

        Tested following upgrade paths:-
        2.3->master
        2.4->master
        2.3->2.4
        2.3->2.5

        All works as expected, passing.

        Show
        Ankit Agarwal added a comment - Tested following upgrade paths:- 2.3->master 2.4->master 2.3->2.4 2.3->2.5 All works as expected, passing.
        Hide
        Dan Poltawski added a comment -

        Congratulations, this change has now made its way upstream. Thanks for your contribution!

        “ Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ” - Rick Osborne

        Show
        Dan Poltawski added a comment - Congratulations, this change has now made its way upstream. Thanks for your contribution! “ Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. ” - Rick Osborne

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Agile