Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37016

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

    Details

    • Story Points (Obsolete):
      8
    • 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()
      

        Gliffy Diagrams

          Activity

          Hide
          mjfrith 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
          mjfrith 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
          poltawski 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
          poltawski 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
          poltawski Dan Poltawski added a comment -

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

          Show
          poltawski Dan Poltawski added a comment - Have you ever installed a modification for calendar, or done anything custom with this data?
          Hide
          mjfrith 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
          mjfrith 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
          geoffwaring 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
          geoffwaring 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
          geoffwaring 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
          geoffwaring 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
          salvetore 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
          salvetore 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
          kstokking 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
          kstokking 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
          salvetore Michael de Raadt added a comment -

          Thanks for the additional information.

          Show
          salvetore Michael de Raadt added a comment - Thanks for the additional information.
          Hide
          skodak Petr Skoda added a comment -

          Thanks for the report.

          Show
          skodak Petr Skoda added a comment - Thanks for the report.
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Looks spot on thanks Petr - shifting to the integration queue

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

          Integrated to master, 26, 25 and 24, thanks

          Show
          poltawski Dan Poltawski added a comment - Integrated to master, 26, 25 and 24, thanks
          Hide
          ankit_frenz 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_frenz 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
          poltawski 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
          poltawski 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:
                Fix Release Date:
                13/Jan/14

                Agile