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

Upgrade attempts to use sectioncache before its created

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Jun/12