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

Mistake in lib/db/upgrade.php. Large databases (a lot of block_instance) stop during upgrade.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1, 2.2
    • Fix Version/s: 2.0.5, 2.1.2
    • Component/s: Installation
    • Labels:
      None

      Description

      In lib/db/upgrade.php line 2124 (version of Tue Jul 5 2011, last git commit modified this file: 2fa78e85e9fa9b05f211fe77f469990768abf0d2) is:
      if (count($contextids) > 1000) {
      Should be:
      if (count($instanceids) > 1000) {

      This line (2124) is below the the line/condition:
      if ($oldversion < 2009082800) {

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            skodak Petr Skoda added a comment -

            I agree, this looks like a bug.

            Show
            skodak Petr Skoda added a comment - I agree, this looks like a bug.
            Hide
            skodak Petr Skoda added a comment -

            there is probably also missing the if ($instanceids) around the

            $instanceidstring = join(',',$instanceids);
            $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');

            Show
            skodak Petr Skoda added a comment - there is probably also missing the if ($instanceids) around the $instanceidstring = join(',',$instanceids); $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
            Hide
            mwojcik Mateusz Wójcik added a comment -

            Yes, mysql query with code "IN ()" (without arguments for operator IN) throws syntax error.

            Show
            mwojcik Mateusz Wójcik added a comment - Yes, mysql query with code "IN ()" (without arguments for operator IN) throws syntax error.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Petr, this has been integrated now

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Petr, this has been integrated now
            Hide
            nebgor Aparup Banerjee added a comment -

            test step 1 is going to take a very long time :-D

            Show
            nebgor Aparup Banerjee added a comment - test step 1 is going to take a very long time :-D
            Hide
            nebgor Aparup Banerjee added a comment -

            the upgrade worked fine for me. (code was tweaked to lesser instances)

            Show
            nebgor Aparup Banerjee added a comment - the upgrade worked fine for me. (code was tweaked to lesser instances)
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Sent upstream and closing, many thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Sent upstream and closing, many thanks!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Oct/11