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

Upgrade attempts to use sectioncache before its created

XMLWordPrintable

    • MOODLE_23_STABLE
    • MOODLE_23_STABLE
    • Hide
      1. Checkout Moodle 2.2
      2. Create a course with at least 3 sections
      3. In section 1
      4. Fake some duplicate course_section records in the database. This is how I did it:
        1. Check there are two sections in 2 and 3:

          integration=# select * from mdl_course_sections where section = 2 or section = 3 and course = 2;
           id | course | section | name | summary | summaryformat | sequence | visible 
          ----+--------+---------+------+---------+---------------+----------+---------
            4 |      2 |       2 |      |         |             1 |          |       1
            5 |      2 |       3 |      |         |             1 |          |       1
          (2 rows)

        2. Update one of the records to be a duplicate course-section:

          integration=# update mdl_course_sections set section = 3 where section = 2;
          UPDATE 1

        3. Verify the duplicate is there:

          integration=# select * from mdl_course_sections where section = 3 and course = 2;
           id | course | section | name | summary | summaryformat | sequence | visible 
          ----+--------+---------+------+---------+---------------+----------+---------
            5 |      2 |       3 |      |         |             1 |          |       1
            4 |      2 |       3 |      |         |             1 |          |       1
          (2 rows)

      5. Upgrade to 2.3
      Show
      Checkout Moodle 2.2 Create a course with at least 3 sections In section 1 Fake some duplicate course_section records in the database. This is how I did it: Check there are two sections in 2 and 3: integration=# select * from mdl_course_sections where section = 2 or section = 3 and course = 2; id | course | section | name | summary | summaryformat | sequence | visible ----+--------+---------+------+---------+---------------+----------+--------- 4 | 2 | 2 | | | 1 | | 1 5 | 2 | 3 | | | 1 | | 1 (2 rows) Update one of the records to be a duplicate course-section: integration=# update mdl_course_sections set section = 3 where section = 2; UPDATE 1 Verify the duplicate is there: integration=# select * from mdl_course_sections where section = 3 and course = 2; id | course | section | name | summary | summaryformat | sequence | visible ----+--------+---------+------+---------+---------------+----------+--------- 5 | 2 | 3 | | | 1 | | 1 4 | 2 | 3 | | | 1 | | 1 (2 rows) Upgrade to 2.3

      Testing upgrade from 2.2.3 to 2.3dev/beta (Build: 2012061800) getting the following reproducible error:

      Error writing to database

      !! Unknown column 'sectioncache' in 'field list'
      UPDATE course SET sectioncache = NULL
      [array (
      )]
      Error code: dmlwriteexception !!
      !! Stack trace: * line 416 of /lib/dml/moodle_database.php: dml_write_exception thrown

      • line 1130 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 1525 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->set_field_select()
      • line 1215 of /lib/modinfolib.php: call to moodle_database->set_field()
      • line 388 of /lib/db/upgrade.php: call to rebuild_course_cache()
      • line 1481 of /lib/upgradelib.php: call to xmldb_main_upgrade()
      • line 153 of /admin/cli/upgrade.php: call to upgrade_core()
        !!

      I am using debian squeeze with the standard-debian-packages of apache2, php5 & mysql-5.1.

            poltawski Dan Poltawski
            wuttke Michael Wuttke
            Sam Marshall Sam Marshall
            Sam Hemelryk Sam Hemelryk
            Sam Hemelryk Sam Hemelryk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.