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 Bug
    • Status: Closed
    • Priority: Major 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
    • Rank:
      18215

      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) {

        Activity

        Hide
        Petr Škoda added a comment -

        I agree, this looks like a bug.

        Show
        Petr Škoda added a comment - I agree, this looks like a bug.
        Hide
        Petr Škoda 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
        Petr Škoda 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
        Mateusz Wójcik added a comment -

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

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

        Thanks Petr, this has been integrated now

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

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

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

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

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

        Sent upstream and closing, many thanks!

        Show
        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: